remix-forms icon indicating copy to clipboard operation
remix-forms copied to clipboard

Add random id prefix to input ids

Open danielweinmann opened this issue 3 years ago • 4 comments

danielweinmann avatar May 04 '22 12:05 danielweinmann

Perhaps React's useId hook can help us achieve that.

andrepinho avatar Jul 15 '22 13:07 andrepinho

@andrepinho thought the same but this is only react@^18 . Not sure if we can use it yet.

gustavoguichard avatar Jul 15 '22 14:07 gustavoguichard

What should be the approach here then? Generate any random string?

felipefreitag avatar Dec 08 '22 17:12 felipefreitag

@felipefreitag, the random string should be shared between the server and client to avoid hydration errors. Once we implement #124, we'll have a Context for each field. That might help with this issue: if we store the random id in the Context, it will be shared. Maybe we wait for #124?

danielweinmann avatar Dec 08 '22 18:12 danielweinmann

We can use useId now that v3 is gonna require react@18. I'm closing this issue since it is a duplicate of #238

gustavoguichard avatar Jan 08 '25 15:01 gustavoguichard