FortAwesome / react-fontawesome

Font Awesome React component
https://fontawesome.com
MIT License
3.67k stars 262 forks source link

React id mismatch with SSR font awesome mask #550

Open flippidippi opened 1 year ago

flippidippi commented 1 year ago

Describe the bug With Next.js/SRR, Getting errors like Prop id did not match. Server: "clip-EcZ4B045I3jF" Client: "clip-MBNTauDeff3J". when using mask.

Reproducible test case

Expected behavior The id should be the same on the server and client

Desktop (please complete the following information):

Additional context N/A

altearius commented 1 year ago

I've also noticed this.

I believe I have tracked this down to the usage of nextUniqueId() function on line 1498 of @fortawesome/fontawesome-svg-core/index.js.

I suspect nextUniqueId() should be replaced by useId() for React 18+, though I am not sure how best to support lower React versions.