Giter Site home page Giter Site logo

Comments (2)

micha-f avatar micha-f commented on May 20, 2024 1

Closing this after discussion with @TejasQ. You can always specify a different base in a Get and be completely independent from nesting.

from restful-react.

TejasQ avatar TejasQ commented on May 20, 2024

Typically, components that nest also map to nested resources, hence the current design. I could also make the docs a little bit clearer about that API.

I think if we decide to implement your feature request, it'll have to be an add instead of a modify, which will be backwards compatible. So specced out, path could be a string, in which case it nests, or a function in which case it works the way you require. I'm still fairly unclear about the use case/need it'll be meeting.

From your second considered alternative, the <Path /> component, the only way its children would have access to the path from the Path component in that case is via function children. Your sample would actually look like

<Path path="/author/123">
{(path) => <>
  <Get path={`${path}/bio`}>
    {(data => <div>{data}</div>}
  </Get>
  <Get path={`${path}/books`}>
    {(data => <div>{data}</div>}
  </Get>
</>}
</Path>

I'm not sure that is easy to read. Seems to me like your preferred solution would be the way to go on this.

I'm curious: is there a particular use case you have in mind that the current API is not meeting?

from restful-react.

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.