bietkul / react-reactive-form

Angular like reactive forms in React.
MIT License
309 stars 32 forks source link

Custom components are not rendered when state changes #62

Closed geraldosalazar16 closed 4 years ago

geraldosalazar16 commented 4 years ago

Describe the bug If you use a custom component inside a FieldControl, it only renders at the beginning, but after that, if you change the state, it will keep its initial values

To Reproduce Steps to reproduce the behavior: Here us a stackblitz showing the issue. I am using this library https://github.com/JedWatson/react-select So inside the render method of the form field, I am trying to use this component instead of a html select, and it takes the default options. In componentDidMount, I have set up a setTimeout to represent a API call, and after the timeout is finished, options are loaded but the component still shows no options https://stackblitz.com/edit/react-myx6ak

Expected behavior I expect that when the render function runs, the custom field should re-render

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

Additional context Add any other context about the problem here.

bietkul commented 4 years ago

Use strict as false for that control and the parent control. https://github.com/bietkul/react-reactive-form/issues/10#issuecomment-388720374

bietkul commented 4 years ago