I just try to use react hook recently.
If I extends Componet, I declare my state like this:
constructor(props) {
super(props);
// dummy state
this.state = {
focus: false
name: 'test'
image: ''
avatarSource: '',
imageBase: 'sfsafsfasf',
imageLoader: null,
}
If I want to send all of the state values, I will use ...this.state
just like:
sendStateFunction(...this.state);
If I use react hook, I declare my state like this:
const test = () => {
const [name, setName] = useState('');
const [image, setImage] = useState('');
const [sex, setSex] = useState(0);
const [id, setId] = useState('');
}
But I have no idea how to send all of the state values just use one line code:
sendStateFunction(); // What should I type the arguments ?