Skip to content

Routing problem #42

Description

@BlancNicolas

Hi ! I wanted to change home to login as first page. So I modified index.js in /src/routes.

What I have changed

export default [

  {
    path: ['/','/login'],
    children: [
      login,
    ],
    async action({ next, render, context }) {
      const component = await next();
      if (component === undefined) return component;
      return render(
        <App context={context}>{component}</App>
      );
    },
  },


  {
    path: '/home',

  // keep in mind, routes are evaluated in order
    children: [
      home,
      // contact,
      table,
      button,
      flotcharts,
      forms,
      grid,
      icons,
      morrisjscharts,
      notification,
      panelwells,
      typography,
      // register,
      blank,
      // place new routes before...
      // content,
      error,
    ],
    async action({ next, render, context }) {
      // console.log('inside dashboard');
      const component = await next();
      // console.log('inside dasdboard component', component);
      if (component === undefined) return component;
      return render(
        <div>
          <Header />
          <div id="page-wrapper" className="page-wrapper">
            <App context={context}>{component}</App>
          </div>
        </div>
      );
    },
  }, 

Problems

1)
The problem is that my CSS didn't load on localhost:3000, and loaded on localhost:3001 (with browsersync though).

2)
When I go to localhost:3001/home, the dashboard appears but it disappears few seconds after. And with the default routing, there is no problem so I guess I don't understand how routing works in this bundle.

The errors from the console

warning.js?85a7:36 Warning: Failed prop type: Invalid prop `children` of type `boolean` supplied to `App`, expected a single ReactElement.
    in App

warning.js?85a7:36 Warning: setState(...): Can only update a mounted or mounting component. This usually means you called setState() on an unmounted component. This is a no-op. Please check the code for the ContainerDimensions component.

Thanks for your job, and for this amazing pack !

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions