DanNeon's avatar

Changing name to first_name in profile.tsx gives weird warning

I've changed the [name] user variable and table column to [first_name], so that I can also add [surname] for better user comms.

Most things have updated okay, but I can't work out why this change in the profile.tsx Input block defaultValue={auth.user.first_name} is giving this warning 'The expected type comes from property 'defaultValue' which is declared here on type 'IntrinsicAttributes & ClassAttributes<HTMLInputElement> & InputHTMLAttributes<HTMLInputElement>''

I'm assuming I need to change from name to first_name somewhere upstream, but I can't work out where.

Where is auth.user coming from?

1 like
5 replies
vincent15000's avatar

What techno are you using ? Give the context of the project please, otherwise we can only try to guess it.

DanNeon's avatar

Laravel 12 with the React starter kit, Fortify for user auth.

1 like
vincent15000's avatar

I never change the name to first_name. I did it by the past, but it's not the best way.

The users table is according to me a table with the connection datas.

If you need to add other informations, it's sometimes convenient to add an informations table with the firstname, the lastname, the address, ... and a one-to-one relationship between the User and the Information table.

If you really need to change name to firstname, you have to change this at very different places in the code (startkit, Fortify, ...).

DanNeon's avatar

Thanks Vincent, You're probably right. Maybe I'll change name back and add a new nickname field instead, that way I don't have to make loads of customisations to the core set up.

1 like
vincent15000's avatar

I do this also, just adding new fields inside the users table doesn't disturb the authentication process and it's just fine to do so if you just need only few additionnal fields.

If it's ok for you, don't forget to close the post.

Please or to participate in this conversation.