Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

how to access variables from render() to outside of render() in class react component

// React
class Parent extends React.Component {
    constructor(props) {
       super(props);
       this.name = props.name
    }
    render() {
       return (
            <h1>
              {this.name}
           </h1>
      );
   }
}
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #access #variables #class #react #component
ADD COMMENT
Topic
Name
8+6 =