Input select option in form into the API in JS

219 Views Asked by At

I want store my data to my backend API, I already put the value too but the option didn't detected, but when I using input its working when I submit it

    <form onSubmit={ storePost }>

 <div className="field mt-5">
  <label className="label">Type A/label>
                                  
div className="controls">
    <select name="typeA" id="typeA"value={TypeAInput} onChange={(e) => setTypeA(e.target.value)} >
                                
      {
                                       
          postsType.map((category)=>  {
               return(
                     <option className="" value="{category.id}"  >{category.type_a} 
                      </option>
                      )})}
                      </select>  

                            </div>
                                </div>
                              
div className="field mt-5">
  <button className="button is-success is-fullwidth" variant="primary" type="submit">
    Register</button>
                            </div>
                            </form>

The array from the mapping is working but when I try to submit nothing happen.

0

There are 0 best solutions below