Coder Social home page Coder Social logo

Layout routing about wouter HOT 6 CLOSED

molefrog avatar molefrog commented on April 30, 2024
Layout routing

from wouter.

Comments (6)

molefrog avatar molefrog commented on April 30, 2024 1

Hey @popuguytheparrot can you share a codesandbox once again?

from wouter.

cbbfcd avatar cbbfcd commented on April 30, 2024

so i had made a PR .
then we can use default instead of /:rest*.

from wouter.

popuguytheparrot avatar popuguytheparrot commented on April 30, 2024

@cbbfcd
Hi. Thank you. It will work with nested switch and some default routes ?

from wouter.

cbbfcd avatar cbbfcd commented on April 30, 2024

@popuguytheparrot
do you think if we can add default props on Swith, would be funny?
like this test case:

it("render default route with nested switch when no route's path be matched", () => {
  const result = testRouteRender(
    "/app/child/users",
    <Switch>
      <Route path="/anything-one"><h1 /></Route>
      <Route path="/anything-two"><h3 /></Route>
      <Switch default>
        <Route path="/test-h4"><h4 /></Route>
        <Route default><h6 /></Route>
        <Route path="/test-h5"><h5 /></Route>
      </Switch>
    </Switch>,
    '/app'
  );

  const rendered = result.children[0].children;

  expect(rendered.length).toBe(1);
  expect(result.findByType("h6")).toBeTruthy();
});

from wouter.

popuguytheparrot avatar popuguytheparrot commented on April 30, 2024

@molefrog https://codesandbox.io/s/inspiring-aryabhata-bi4nz

from wouter.

molefrog avatar molefrog commented on April 30, 2024

@popuguytheparrot The behavior you need can be achieved:
https://codesandbox.io/s/peaceful-wright-90jfy

@cbbfcd Still haven't decided what to do with your PR, the ideas look good, but you would make a little step back and implemented these features one by one. I like the default concept btw!

from wouter.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.