I am working on a React project which is fetching data from Prismic headless CMS. Fetching data is an async function.
In HTML template I'm checking if data is fetched before rendering it with basic ternary operator ( { data ? (render data) : (no data fetched) } )
So in HTML, I want to set up some React DOM references. These references are needed in order to add animation elements later on.
My problem is that first I get null from reference (default value) and then I get useful reference value once data is fetched.
How could I stop the function that handles the state for animation from running until data is fetched?
Thanks.