Is there any differences between having component state bundled up as single object like this (1)
const [state, setState] = useState({
title: 'Jerome Is Coming!',
year: '1998'
})
versus having separate state with primitive values to track each component state, like this (2)
const [title, setTitle] = useState('Jerome Is Coming!')
const [year, setYear] = useState('1998')
?
Edit: I do aware of the suggested usage pattern. To add to this question what I want to know is is there any difference in terms of runtime performance by doing it one way instead of the other especialy if my state object is huge.
Will updating just one member state cost the same as updating the entire state object? If not the same, is the difference significant?