Skip to content
This repository was archived by the owner on Dec 15, 2018. It is now read-only.

Conversation

dpwrussell
Copy link

@dpwrussell dpwrussell commented Sep 19, 2016

This is a React Component that closely mirrors how people use React Router at present. PlaceholderFragment is kind of a crappy name.

Usage like so:

import ExampleComponent from './ExampleComponent';

const routes = {
  '/': {
    '/test': { component: ExampleComponent, componentProps: { a: 1, b: 2 } }
  }
};

export default routes;
<PlaceholderFragment
  forRoute='/test'
  componentKey='component'
  componentPropsKey='componentProps'
/>

Basically in routes a component and optional component props are defined. The PlaceholderComponent takes whatever component is specified for the route (identified by whatever componentKey is specified) and renders it.

I haven't got to it yet, but I would like to look also at getComponent like behaviour.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant