score:1

Accepted answer

the argument for your higher-order component is the class (or function) for the component that you want to wrap, not an instance of that component.

what you want to do is create a new component by applying the hoc to the wrapped/inner component. this should happen outside of render() because it should only happen once and not on every re-render.

  const fetchablesubreddits = withfetch(subreddits);

then inside your render you can use this like any other jsx component.

<fetchablesubreddits someprop={somevalue} />

Related Query

More Query from same tag