Closed kolpav closed 7 years ago
Great points. Thanks for the feedback! I'll make another release with these changes.
@kolpav I just published a new release branch for review. Check it out here.
Now inside a Next.js page you can use withData
like so:
const Home = props => (
<Main>
<Header pathname={props.url.pathname} />
<Submit />
<PostList />
</Main>
)
export default withData(config)(Home)
Is this what you envisioned?
All set! Going to close. Let me know if you have any further feedback.
Hi,
Nice library 👍 but I think there is room for improvement for api of
withData
also I don't think I would call it a HOC. From react documentation pageBut you are taking two parameters, config object and component as second parameter.
Why does it matter?
Every HOC out there does configuration like this
You can take a look at
redux-form
'sreduxForm
orreact-redux
'sconnect
from top of my head. Basically if you need configuration for your HOC you make it HOC factory.You can't use
compose
like with every other HOCconst CoolComponent = props => ...
export default compose( connect(mapStateToProps, mapDispatchToProps), reduxForm({...}), withCurrentRoute, withData ??? <==== here is the problem )(CoolComponent)