I\'m trying to use react hooks for a simple problem
const [personState,setPersonState] = useState({ DefinedObject });
with following depend
First of all, you need to uppercase the FirstLetter of your components, in your case app should be App and person should be Person.
I tried to copy your code in the hope of finding the issue. Since you did not share how you call the App component, I can only see 1 way to result this to an issue.
This is the link in CodeSandbox: Invalid hook call.
Why? Because of the code below which is wrong:
ReactDOM.render(App(), rootElement);
It should have been:
ReactDOM.render( , rootElement);
For more info, you should read Rule of Hooks - React
Hope this helps!