简体   繁体   中英

how can i change firstname/lastname to firstName/lastName in react? the problem is that it comes from the backend

the back-end example { "email": "string", "password": "string", "firstName" : "string", "lastName" : "string" }

i'm using TextInput:

     <TextInput 
           name='firstname'
           type='text'
           label='First Name'  
           placeholder='John'/>

my mistake was in formik, i writes value names wrong

  <Formik 
    initialValues={{email: "", password: "", firstname: "", lastname: "", 
     passwordConfirm: ""}}
   >

**should be **

<Formik 
        initialValues={
              {email: "", 
               password: "", 
             **firstName: "",** 
             **lastName:""**, 
         passwordConfirm: ""}}
       >

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM