Support SSR mode
Description
In SSR mode, useSpinDelay always returns false even though loading = true because useEffect is not executed in SSR mode.
Solution
Return the value of the loading variable in SSR mode.
@smeijer, could you please help review this PR?
Hi! Thanks for the PR. I appreciate it, and acknowledge the issue. I haven't tried it, but purely based from the code I see I believe this can result into a spinner flash. The one thing this lib tries to prevent.
If the server now passes a loading = true, a spinner is shown. When the client sets it to false, the spinner directly dissappears. Even if the flip happens in a fraction of a second.
Can you confirm that?
Hi, I've given this branch a test run, and indeed found the expected issues. This spinner flickers on the initial render. I've changed the approach in #8 . Thank you so much for the idea and your contribution.