recompose icon indicating copy to clipboard operation
recompose copied to clipboard

fromRenderProps RenderPropsComponent props

Open sshmyg opened this issue 7 years ago • 3 comments

Hi. As I know when I use renderComponent renderer component gets props from previous HOCs. But here fromRenderProps, component doesn't get nothing.

Is there any reason why component from fromRenderProps not get props from previous HOCs?

export default compose(
    defaultProps({
        query: {
            a: 10
        }
    }),

    fromRenderProps(Query, ({ writeData }) => ({
        writeData
    })),
);

Expect: Query component gets query as prop during initialization here fromRenderProps. Actual: Query initializes without props;

sshmyg avatar Sep 18 '18 09:09 sshmyg

cc @evenchange4

istarkov avatar Sep 18 '18 10:09 istarkov

@istarkov Having this fixed locally for some time, I've finally found some time to push it.

brabeji avatar Sep 24 '18 10:09 brabeji

@sshmyg AFAIK, the first argument of fromRenderProps is something like Consumer of React context, e.g., ThemeContext.Consumer. It is not the target component that gets wrapped inside the final HOC, therefore this is an expected behavior and not a bug.

elquimista avatar Nov 28 '18 23:11 elquimista