import { useState } from 'react';
function App() {
const resultFromUseStateHook = useState('initial value of a piece of state');
console.log('A reference to the piece of state:', resultFromUseStateHook[0]);
console.log('A function to update this piece of state:', resultFromUseStateHook[1]);
}
export default App;
import { useState } from 'react';
const Post = () => {
const [likesCount, setLikesCount] = useState(0);
return (
<section>
<p>What is the number of likes we should display? {likesCount}</p>
</section>
);
};
export default Post;