streamich / react-universal-interface

Universal Component Interface - FaCC, render prop, component prop, prop injection, HOC, decorator

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Request new feature

baoduy opened this issue · comments

Hi, this is really nice interface for React component development. However, I would like to request a new feature allow to pass a props to HOC.

Example:

const child = withData(props)(MyChid);
commented

You can do now

const child = withData(MyChild, 'data', props);

Or you could do

const withData2 = props => MyChild => withData(MyChild, 'data', props);
const child = withData2(props)(MyChild);

I have tried but it is not working. I want to pass the props to WithData component instead of to MyChild component.

My workaround:

export const withData = config => Component => props => (
  <WithData config={config}>
    <Component {...props} />
  </WithData>
);