[SOLVED]-NEW DATE().GETFULLYEAR() IN REACT-REACTJS

NEW DATE().GETFULLYEAR() IN REACT-REACTJS

Uou need to put the pure javascript inside {}. this works for me:

class hellomessage extends react.component {
  render() {
    return <div>{(new date().getfullyear())}</div>;
  }
}

reactdom.render(<hellomessage />, mountnode);

the compiled version is:

class hellomessage extends react.component {
  render() {
    return react.createelement(
      "div",
      null,
      new date().getfullyear()
    );
  }
}

reactdom.render(react.createelement(hellomessage, null), mountnode);
0 0 votes
Article Rating
Subscribe
Notify of
guest
0 Comments
Inline Feedbacks
View all comments