Rocon Website

RoconRoot

RoconRoot: React.FunctionComponent<{
  history?: History;
}>

The RoconRoot component should be placed above any other component that use hooks or components provided by Rocon.

By default, this component creates a History instance bycreateBrowserHistory(). If you want to use a customized instance of History, pass it to this component as a history prop.

Example

const builder = Rocon.Path()
  .routes({
    foo: {
      action: () => <p>This is foo</p>
    },
    bar: {
      action: () => <p>This is bar</p>
    }
  });

const Routes: React.FC = () => {
  return useRoutes(builder);
};

const YourApp: React.FC = () => (
  <RoconRoot>
    <Routes />
  </RoconRoot>
);