github.com/maeglindeveloper/gqlgen@v0.13.1-0.20210413081235-57808b12a0a0/example/chat/src/App.js (about)

     1  import React, { useState } from 'react';
     2  import styled from 'styled-components';
     3  import { Room } from './Room';
     4  
     5  const Input = styled.div`
     6      padding: 4px;
     7      margin: 0 0 4px;
     8  
     9      input {
    10          border: 1px solid #ccc;
    11          padding: 2px;
    12          font-size: 14px;
    13      }
    14  `;
    15  
    16  export const App = () => {
    17      const [name, setName] = useState('tester');
    18      const [channel, setChannel] = useState('#gophers');
    19  
    20      return (
    21          <>
    22              <Input>
    23                  name: <input value={name} onChange={(e) => setName(e.target.value)} />
    24              </Input>
    25              <Input>
    26                  channel: <input value={channel} onChange={(e) => setChannel(e.target.value)} />
    27              </Input>
    28  
    29              <Room channel={channel} name={name} />
    30          </>
    31      );
    32  
    33  };