(ERC) Extended React Component
Set properties in React Components like in Angular
All you need, is define this.s
this.s
equal this.state
, but now you can set properties like this:
thiss = test: 1;// console.log(this.s.test);// -> 1 thisstest = 2;// console.log(this.s.test);// -> 2 this;// console.log(this.s.test);// -> 3 thisstate = test: 4;// console.log(this.s.test);// -> 4 thisstest = 5;// console.log(this.state.test);// -> 5
Example:
import React from "react";import ExtendedComponent from "erc2"; { ; thiss = test: 1 ; ; } { return <div ="index-page"> <div> thisstest: thisstest </div> <div> thisstatetest: thisstatetest </div> </div> ; }