Skip to content

Tag: reactjs

React suspense/lazy delay?

I am trying to use the new React Lazy and Suspense to create a fallback loading component. This works great, but the fallback is showing only a few ms. Is there a way to add an additional delay or minimum time, so I can show animations from this component before the next component is rendered? Lazy import now…

Is it okay to call onClick on an anchor tag in ReactJS

Folks, I have an anchor tag inside my component like so: I want to call an analytics function when user clicks on this tag like so: Notice that I’m not setting state or calling any of the react functions. Is it okay if I just call a function on the onClick event of the anchor tag? Something like this: w…

react useEffect comparing objects

I am using react useEffect hooks and checking if an object has changed and only then run the hook again. My code looks like this. Unfortunately it keeps running as the objects are not being recognised as being the same. I believe the following is an example of why. Perhaps running JSON.stringify(apiOptions) w…