August 2017
Beginner
374 pages
10h 41m
English
To deal with state, we are going to turn our functional component into a class component. As an example, we will make a timer that shows how many seconds a user has spent on the page. First of all, let's write this timer as a functional component:
const Timer = ({ seconds }) =>
<h1>You spent {seconds} seconds on this page!</h1>
Read now
Unlock full access