A type of state where the value is used from the props in the case of them being set.
Otherwise, an internal set of properties are used. This is useful in the case that you want to allow properties to control the state of the component, but this functionality is to be optional.
The type of data for the state.
The current value from the props. If this is undefined, then the internal state is used.
The mutator method to set the current value. This can be undefined, but if it is set, both the internal value and the prop value are set.
A tuple where the first item is the current state and the 2nd item is a mutator method to modify the state.
A type of state where the value is used from the props in the case of them being set.
Otherwise, an internal set of properties are used. This is useful in the case that you want to allow properties to control the state of the component, but this functionality is to be optional.
The current value from the props. If this is undefined, then the internal state is used.
The mutator method to set the current value. This can be undefined, but if it is set, both the internal value and the prop value are set.
The initial value to set if current is undefined.
A tuple where the first item is the current state and the 2nd item is a mutator method to modify the state.
A type of state where the value is used from the props in the case of them being set.
Otherwise, an internal set of properties are used. This is useful in the case that you want to allow properties to control the state of the component, but this functionality is to be optional.
Param: current
The current value from the props. If this is undefined, then the internal state is used.
Param: setCurrent
The mutator method to set the current value. This can be undefined, but if it is set, both the internal value and the prop value are set.
Param: initial
The initial value to set if current is undefined.
Param: T
The type of data for the state.
Returns
A tuple where the first item is the current state and the 2nd item is a mutator method to modify the state.