Next.js Discord

Discord Forum

A props object containing a "key" prop is being spread into JSX

Unanswered
Aditya Kirad posted this in #help-forum
Open in Discord
Hey folks I'm using conform as form validation library with NextJs also I'm using better-auth as my auth library here is my code
https://mystb.in/d696cbf5421765be37
I don't know why it's throwing this error
The same code didn't throw any error like this Remix.run so I'm assuming it's a NextJs issue can anyone help me to deal with it

5 Replies

It’s probably a react rule enforced by the linter.

Could you do this?

const {key, …restProps} = props

And then pass key = {key} and {…restProps} to the component that’s using them?
you can do {...props} key={props.key} to fix it
if this is Conform, the next release will no longer use the key to reset inputs so this will go away, you could just choose to ignore it until then
@Mallow bee this is a new error in React 19
thanks Jacob I was using react version 18.3.0 in remix project