Comments (2)
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.
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)
- "refetch" cause react components to re-render always HOT 2
- Security Vulnerability with dependency
- Boilerplate from one openapi spec HOT 3
- `--github` flag seems to no longer work HOT 2
- Stable Code Generation. HOT 3
- Final path parameter in DELETE requests is excluded from generated interfaces in `--skipReact` mode HOT 1
- Asynchronous onRequest/onResponse hooks HOT 1
- Delete request with two path parameters only generates with the first parameter HOT 1
- Throw exception on error refetch
- Generating a client with path params containing dots '.' fails HOT 1
- useMutate should take a debounce parameter HOT 1
- Fix allOf in responseBodies generation
- refetch does not respect the mock argument for lazy hooks
- [IMP]SECURITY UPDATE
- Handle file downloads
- Can we bump ibm-openapi-validator
- Hello Tejas
- Can't install restful-react in a React 18 project
- Archive the repo
- Analysis: 100% of dependency updates in this repository can be merged. HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from restful-react.