#root
View Compiled
const { useContext, useState, createContext } = React;
const {render} = ReactDOM;

const UserContext = createContext(???);

function App() {
  // ???
  return (
    <UserContext.Provider value={}>
      <UserName />
      <UserNameInput />
    </UserContext.Provider>
  );
}

function UserName() {
  // ???
  return <span>{username}</span>;
}

function UserNameInput() {
  // ???
  const handleInput = (event) => {
    // ???
  }
  return <input type='text' value={username} onChange={handleInput} />;
}

render(<App />, document.getElementById('root'))
View Compiled
Run Pen

External CSS

This Pen doesn't use any external CSS resources.

External JavaScript

  1. https://cdnjs.cloudflare.com/ajax/libs/babel-polyfill/7.8.7/polyfill.min.js
  2. https://cdnjs.cloudflare.com/ajax/libs/react/16.13.1/umd/react.production.min.js
  3. https://cdnjs.cloudflare.com/ajax/libs/react-dom/16.13.1/umd/react-dom.production.min.js