Skip to content

Latest commit

 

History

History
28 lines (23 loc) · 639 Bytes

withMatch.md

File metadata and controls

28 lines (23 loc) · 639 Bytes

withRoute

withMatch is higher-order Match component that matches location.

import React from 'react';
import { render } from 'react-dom';
import createBrowserHistory from 'react-steersman/createBrowserHistory';
import Steersman from 'react-steersman/Steersman';
import withMatch from 'react-steersman/withMatch';

const history = createBrowserHistory();

@withMatch({ path: '/user/:userId' })
class UserInfo extends Component {
  render() {
    const { match } = this.props;
    return match.userId;
  }
}

render(
  <Steersman history={history}>
    <UserInfo />
  </Steersman>,
  document.getElementById('app')
);