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

Placeholder Fragment #81

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open

Placeholder Fragment #81

wants to merge 2 commits into from

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