ReactJS Initial State Example

image
getInitialState() is life cycle method of a ReactJS component. The state can be updated using setState() method.This method takes an JavaScript object. In this demo, “We will learn how to create a initial state object and how to change the value of the state”. Below code contains a react component having two buttons and a text string.The default color of the applyState is red.When user click these button the state value gets change to blue and vice verse.<!doctype html>
<html lang="en">...
 •  0 comments  •  flag
Share on Twitter
Published on December 18, 2014 09:31
No comments have been added yet.