React hooks were just released with version 16.8.

Here’s a small app I created to test out the new useState hook.

  import React, { useState } from 'react';
  import ReactDOM from 'react-dom';

  export function App() {
    const [name, setName] = useState('Zach');

    function changeName() {
      let newName = prompt('What is your name?');
      if (newName) {
        setName(newName);
      }
    }

    return (
      <div>
        <h1>Hello, {name}!</h1>
        <button onClick={changeName}>My name isn't {name}</button>
      </div>
    )
  }

  ReactDOM.render(
    <App/>,
    document.getElementById('root')
  )