To use an object as the content of your state, you need to use the useState
hook as you would with any primitives. Instead of passing a single value you pass the object. As shown below.
If you are using typescript, you just need to pass the type definitions as you would with any primitives - or allow the compiler to infer the type.
const [loginData, setLoginData] = useState({
name: '',
email: '',
password: '',
});
The simple wat o think about it is that you spread the current state value and subsequently update the key-value pair you would like to update.
setLoginData({...loginData, name: 'Jorge'});