Closed Writ3r closed 2 days ago
A bit more info - I gave nextjs a shot to see if it'd render these correctly or not (for more datapoints on if these components work with SSR in general), and it did tell me the CountUp component should be only client rendered because it uses a useRef, however the react-bootstrap Col had no problems with SSR. So there is some sort of an issue here, just the CountUp component maybe was a worse example of this bug than the react-bootstrap Col is.
I got a bit deeper into the weeds of testing this on nextjs, and it did run into similar issues with other components. I am thinking at this point that possibly the recent versions of react are not playing well in conjunction with older components when SSR is used in general. So I'll close out this issue here since I'm doubting remix is the cause of this.
Reproduction
npx create-remix@latest
npm i react-countup
import CountUp from 'react-countup';
<CountUp duration={1} end={1} decimals={0}></CountUp>
npm run dev
and notice the page errors out on the SSR. If you force the component to render client-side only it works fine.Note - this also happens for react-bootstrap with the 'Col' component as well, which interestingly enough a hacky workaround is to just copy the Col component code out of the react-bootstrap repository and paste it into a local file called 'Col' and it works fine if you import it from that local file.
If I'm doing something wrong here let me know and close out this issue, I'm new to using Remix but I can't find definitive info on why these fairly well-used components would fail to render like this.
System Info
Used Package Manager
npm
Expected Behavior
The component renders correctly or at least doesn't error out during the server-side render
Actual Behavior
The run dev output shows this error: