kryptokay / kwallet

0 stars 0 forks source link

Introduce component state #5

Open rmallols opened 6 years ago

rmallols commented 6 years ago

The state is a core concept in React. Its main purpose is to update the UI immediately as soon as soon as the data model changes: https://www.tutorialspoint.com/reactjs/reactjs_state.htm

Live demo: https://jsfiddle.net/67675ag9

  1. Create a new state property called keys with a loading message (Generating keys...).
  2. Display the message on the screen.
  3. After 3 seconds, update the message with the actual generated keys.
rmallols commented 6 years ago

Hint: use the setTimeout function to change the message after 3 seconds: https://www.w3schools.com/Jsref/met_win_settimeout.asp

rmallols commented 6 years ago

Hint: use arrow functions, when possible https://codeburst.io/javascript-arrow-functions-for-beginners-926947fc0cdc

rmallols commented 6 years ago

Hint: change the message inside of the componentDidMount hook method, to ensuring model is updated once the UI is ready https://reactjs.org/docs/react-component.html#componentdidmount

rmallols commented 6 years ago

Related task on Kodflix: rmallols/kodflix#13