I just read about the react's new feature hooks.Read about hooks but i can't able to use it. it gives me error.
I am currently using version 16.6.0
Finally i got Understand the hooks.
import React, {useState} from 'react';
const Fun = () => {
const [count, setCount] = useState(0);
return (
<div>
<p>You clicked {count} times</p>
<button onClick={() => setCount(count + 1)}>
Click me
</button>
</div>
);}
export default Fun;
I imported as Fun and used as in my app.js file
The mistake i made is i did't install React v16.7.0-alpha so i installed using npm add react@next react-dom@next.
Thank you