holen
holen copied to clipboard
Suggestion: pass url to render prop
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.
This is a great idea. Are there any other values that would be useful to pass?
I can't think of any others right now, but I'll let ya know if that changes :v:
I'll PR this shortly.