Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

React Render Method | Lifecycle Components

The Render Method -

The render () method is used to display the actual outputs HTML to the DOM.

The render () method is required and this method has to return something whether it is null.


Explore to Understand  - React Lifecycle Components

When Render method is called?

When render method is called it returns a new virtual DOM structure of the component.


As an Example,

import React from 'react';


class Header extends React.Component {

  constructor(props) {

    super(props);

    this.state = {msg: "welcome!"};

  }

  render() {

    return (

      h2>{this.state.msg} you anilh2>

    );

  }

}


As an another Example,

public class Header extends React.Component {

  render() {

    return (

      h2>This one is a Header componenth2>

    );

  }

}




This post first appeared on Programming, please read the originial post: here

Share the post

React Render Method | Lifecycle Components

×

Subscribe to Programming

Get updates delivered right to your inbox!

Thank you for your subscription

×