I am working on a React Native app.
I want to be able to call the useAppTracking
function with an id if id
exists, and pass in an empty object if id
doesn't exist. When attempting to assign a default value to id
, I hit an error because I am reassigning a const
. Can someone show me a best-practices way to accomplish what I need, please?
const { id } = route.params;
...
useAppTracking('Goal', id || {});