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
- A _useStateGetter_ that receives an object, with three properties _id_, _name_, _eta_, and returns a tuple with _stateG_, _setterG_and _getter_.
7
+
- A _useStateGetReset_ that receives an object, with three properties _id_, _name_, _eta_, and returns a tuple with _stateG_, _setterG_, _getter_ and _resetter_.
8
8
- A _useState_ that receives same object of useStateGetter and returns a tuple with _state_ and _setter_.
9
9
- Each property of _state_ and _stateG_ is rendered an Input component that renders the input and label fields and the _component's number of renders_.
10
10
- A _onChangeGetter_ function made with useCallback to handle stateGetter input onChange, reading other values with getter function.
11
11
- A _onChange_ function made with useCallback to handle stater input onChange, reading other values by state variable.
12
+
- A button that executes the _resetter_ function on _stateG_.
12
13
The two functions onChange and onChange Getter update their respective _state_ every time they are executed. Since the _onChange_ function depends on the state, every time this changes it will be reevaluated and this will also trigger the rerender of the input components that have not undergone a change to their _value_ variable. The _onChangeGetter_ doesn't have this behavior: since the _getter_ function isn't reevaluated even if the _stateG_ changes, so the _onChangeGetter_ is never reevaluated and only the input component that has a change in the _value_ variable is rerendered.
> - A _useStateGetter_ that receives an object, with three properties _id_, _name_, _eta_, and returns a tuple with _stateG_, _setterG_and _getter_.
55
+
> - A _useStateGetReset_ that receives an object, with three properties _id_, _name_, _eta_, and returns a tuple with _stateG_, _setterG_, _getter_and _resetter_.
55
56
> - A _useState_ that receives same object of useStateGetter and returns a tuple with _state_ and _setter_.
56
57
> - Each property of _state_ and _stateG_ is rendered an Input component that renders the input and label fields and the _component's number of renders_.
57
58
> - A _onChangeGetter_ function made with useCallback to handle stateGetter input onChange, reading other values with getter function.
58
59
> - A _onChange_ function made with useCallback to handle stater input onChange, reading other values by state variable.
60
+
> - A button that executes the _resetter_ function on _stateG_.
59
61
> The two functions onChange and onChange Getter update their respective _state_ every time they are executed. Since the _onChange_ function depends on the state, every time this changes it will be reevaluated and this will also trigger the rerender of the input components that have not undergone a change to their _value_ variable. The _onChangeGetter_ doesn't have this behavior: since the _getter_ function isn't reevaluated even if the _stateG_ changes, so the _onChangeGetter_ is never reevaluated and only the input component that has a change in the _value_ variable is rerendered.
0 commit comments