@reach/router#Match JavaScript Examples

The following examples show how to use @reach/router#Match. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: Ai.js    From network-rc with Apache License 2.0 5 votes vote down vote up
render() {
    const {
      state: { sampleList, ai, loading },
      props: { controller, cameraEnabled, canvasRef },
      menuItem,
    } = this;

    return (
      <Spin spinning={loading} tip={loading}>
        <Match path=":current">
          {(props) => (
            <Menu
              selectedKeys={[props.match && props.match.current]}
              mode="horizontal"
            >
              {menu.map((i) => menuItem(i))}
            </Menu>
          )}
        </Match>
        <Router>
          <AiSample
            path="sample"
            onFinish={(sampleList) => this.setState({ sampleList })}
            sampleList={sampleList}
            canvasRef={canvasRef}
            cameraEnabled={cameraEnabled}
            controller={controller}
          />
          <AiTrain
            path="train"
            sampleList={sampleList}
            controller={controller}
            ai={ai}
          />
          <AiDrive
            path="drive"
            controller={controller}
            canvasRef={canvasRef}
            cameraEnabled={cameraEnabled}
            ai={ai}
          />
        </Router>
      </Spin>
    );
  }