react-file-icon
react-file-icon copied to clipboard
Use React.useId() instead of lodash.uniqueid
When using SSR (e.g. with Remix or Next) lodash.uniqueid will cause a hydration mismatch warning because the server will have different IDs from the client.
This PR uses React.useId() which returns a unique ID that is stable between client and server. I also omit IDs when jest is defined so that the test snapshots will match.
@kensnyder Thanks for this! I didn't even know React a function for that. My only concern is it looks like this is will only work in React 18+ (we currently support ^18.0.0 || ^17.0.0 || ^16.2.0). Still debating if it's worth just bumping the major version. 🤔
Closing in favor of #53.