Suggestion: pass url to render prop
jamesplease opened this issue · 2 comments
jamesplease commented
One thing users may need to do is modify the URL based on the state of whatever is rendered from within the render prop. An example would be setting the "base URL" on <Holen/>
and then configuring query parameters within the components rendered in render
/children
.
Example:
// parent.js
<Holen url="/posts" lazy>
(result) => (<Child {...result}/>)
</Holen>
// child.js
this.props.fetch({
url: this.props.url + qs.stringify(this.state.query)
});
This usage of the API can be thought of as Holen
preparing some default configuration of the fetch
for the child to then further customize.
tkh44 commented
This is a great idea. Are there any other values that would be useful to pass?
jamesplease commented
I can't think of any others right now, but I'll let ya know if that changes ✌️
I'll PR this shortly.