Forms with Controlled and Uncontrolled Components - Introduction to React #7

Опубликовано: 06 Октябрь 2024
на канале: NL Tech
663
22

Forms in React can be implemented with controlled and uncontrolled components. The difference between the two methods is where the state is managed. With controlled components, the state is managed by react's state management features. When using uncontrolled components, the input fields manage their own state. Controlled components are implemented by setting the value attribute and onChange event to read and modify a state variable. Uncontrolled components' value can be read either by using refs to access the input elements or by creating a new form data object on form submit.

Contents:
0:00 Introduction
0:48 Controlled Components
2:53 Uncontrolled Components
3:22 FormData Approach
3:52 Conclusion

Email: [email protected]
Twitter:   / nikelaz  
LinkedIn:   / nikola-lazarov  

#react #course