Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR JAVASCRIPT

displaying the date react

import React from "react";

export default class App extends React.Component {
  state = {
    date: ""
  };

  componentDidMount() {
    this.getDate();
  }

  getDate = () => {
    var date = new Date().toDateString();
    this.setState({ date });
  };

  render() {
    const { date } = this.state;

    return <div>{date}</div>;
  }
}
}

export default App;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #displaying #date #react
ADD COMMENT
Topic
Name
6+3 =