You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+4-4Lines changed: 4 additions & 4 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1011,7 +1011,7 @@ class ParentComponent extends React.Component {
1011
1011
1012
1012
The controlled components will be implemented using the below steps,
1013
1013
1014
-
1. Initialize the state using use state hooks in function components or inside constructor for class components.
1014
+
1. Initialize the state using `useState` hooks in function components or inside constructor for class components.
1015
1015
2. Set the value of the form element to the respective state variable.
1016
1016
3. Create an event handler to handle the user input changes through useState updater function or setState from class component.
1017
1017
4. Attach the above event handler to form elements change or click events
@@ -1043,12 +1043,12 @@ class ParentComponent extends React.Component {
1043
1043
1044
1044
22. ### What are uncontrolled components?
1045
1045
1046
-
The **Uncontrolled Components** are the ones that store their own state internally, and you query the DOM using a ref to find its current value when you need it. This is a bit more like traditional HTML.
1046
+
The **Uncontrolled Components** are the ones that store their own state internally, and you query the DOM using a `ref` to find its current value when you need it. This is a bit more like traditional HTML.
1047
1047
1048
1048
The uncontrolled components will be implemented using the below steps,
1049
1049
1050
-
1. Create a ref using useRef react hook in function component or `React.createRef()` in class based component.
1051
-
2. Attach this ref to the form element.
1050
+
1. Create a ref using `useRef` react hook in function component or `React.createRef()` in class based component.
1051
+
2. Attach this `ref` to the form element.
1052
1052
3. The form element value can be accessed directly through `ref` in event handlers or `componentDidMount` for class components
1053
1053
1054
1054
In the below UserProfile component, the `username` input is accessed using ref.
0 commit comments