The Basics on How to Use useState

This will allow for the use of useState throughout a component.
Here a variable and its function setVariable are being declared within the Header function.
Now the initial state of “variable” is an h1 tag with the text “I have been declared!”.
This is what is being rendered on the page because of “variable”
Logic to update the h1 whenever the button is clicked.
This is the logic in action!

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store