React select with value null

后端 未结 2 2120
滥情空心
滥情空心 2021-02-07 00:34

I have the following code as part of my React component:


                        
    
提交评论

  • 2021-02-07 01:22

    I think your problem might be caused by this line:

     value={task.user_id}
    

    The select will always show that as a value regardless of what was selected.

    If your onUserChanged function is right you should see the right value in being selected on the server or on the console, but the client will always see that task.user_id.

    Otherwise everything else seems right in your code.

    0 讨论(0)
  • 提交回复
    热议问题