Skip to content

Instantly share code, notes, and snippets.

@rajeshpillai
Last active October 28, 2019 10:18
Show Gist options
  • Save rajeshpillai/3c3d7515cd226d5eb24c529c7f404693 to your computer and use it in GitHub Desktop.
Save rajeshpillai/3c3d7515cd226d5eb24c529c7f404693 to your computer and use it in GitHub Desktop.

Revisions

  1. rajeshpillai revised this gist Oct 28, 2019. 1 changed file with 0 additions and 6 deletions.
    6 changes: 0 additions & 6 deletions counter.js
    Original file line number Diff line number Diff line change
    @@ -1,9 +1,3 @@
    /*
    Use import if you are running it as create-react-app or using babel.
    import React, {useState} from 'react';
    */

    const {useState, useEffect} = React;

    function Counter() {
  2. rajeshpillai created this gist Oct 28, 2019.
    20 changes: 20 additions & 0 deletions counter.js
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,20 @@
    /*
    Use import if you are running it as create-react-app or using babel.
    import React, {useState} from 'react';
    */

    const {useState, useEffect} = React;

    function Counter() {
    const [counter, setCounter] = useState(0);
    return (
    <div className="content">
    <h1 className="count">{counter}</h1>
    </div>
    );
    }

    const root=document.querySelector("#root");
    ReactDOM.render(<Counter/>, root);