×

React Js

The World's best Software Development Study Portal

ReactJS State

State is place where data intially store. And its also a place where data come from. We should make our data as easy as possible.

Using State

Below example will show how to create state component for React Js using EcmaScript.

App.js

import React, {component} from 'react'; class App extends React.Component{ constructor() { super(); this.state={ Message:"Welcome to my website", Content:"This is Body" } } render(){ return( <div> <h1>{this.state.Message}</h1> <h2>{this.state.Content}</h2> </div> )}} export default App;

 
Output -: Welcome to my website This is Body

After Completing this course you can easily design user interface for Mobile App and Web App.