I am

new to React.I am trying state in functional component.But when i use useState Hook it giving me TypeError: Object(...) is not a function..
My React Version is:
{
"name": "router-app",
"version": "0.1.0",
"private": true,
"dependencies": {
"query-string": "^6.12.1",
"react": "^16.4.1",
"react-dom": "^16.4.1",
"react-router-dom": "^5.1.2",
"react-scripts": "1.1.4"
},
"scripts": {
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"eject": "react-scripts eject"
}
}
Plz help me how should I fix it.
"react": "^16.4.1"
Hook is in [email protected] and up. So update your react and react-dom.
How can i udpate react version?
For npm:
npm install --save react@latest react-dom@latest
For yarn:
yarn add react@latest react-dom@latest
Or create an entirely new app project with latest version of create-react-app
# remove local installation of create-react-app
npm uninstall -g create-react-app
# then fetch run the bin with npx
npx create-react-app yourappname
Looks like this issue has been answered, so I'm going to close it. Thanks @illuminist.
Most helpful comment
"react": "^16.4.1"Hook is in [email protected] and up. So update your react and react-dom.