Пример #1
0
export default createJunctionTemplate(({ split }) => ({
    component: Users,

    children: {
        '/': createPageTemplate({
            title: 'Users',
            component: ContentRenderer,
            getContent: () => import('./UserList').then(m => m.default),
        }),

        '/new': createPageTemplate({
            title: 'New user',
            component: NewUser,
        }),

        '/:id': split(() => Promise.resolve(createPageTemplate({
            title: 'User details',
            params: ['id'],
            component: ContentRenderer,
            getContent: () => Promise.resolve(UserDetails),
        }))),
    },
}))
Пример #2
0
export default createJunctionTemplate(({ split }) => ({
  children: {
    '/users': split(() => import('./Users').then(m => m.default)),

    '/old-users': createRedirectTemplate('/users/'),

    '/': createPageTemplate({
      title: 'Junctions Example',
      component: function() {
        return <div>Welcome!</div>
      }
    }) 
  },

  component:
    class App extends Component {
      render() {
        let junction = this.props.junction
    
        return (
          <div className="App">
            <header className="App-header">
              <img src={logo} className="App-logo" alt="logo" />
              <h1 className="App-title">Welcome to React</h1>
              <Link href="https://reactarmory.com">Go to React Armory</Link>
            </header>
    
            <Link href="/users/">View users</Link>
            <Link href="/old-users/">Old page</Link>
    
            <JunctionComponent junction={junction} />
          </div>
        );
      }
    },
}))
Пример #3
0
 '/:id': split(() => Promise.resolve(createPageTemplate({
     title: 'User details',
     params: ['id'],
     component: ContentRenderer,
     getContent: () => Promise.resolve(UserDetails),
 }))),