heaks
heaks

Reputation: 77

React recompose pass props

For example, we have a container <ContainerName data=someData> and pass some props data.

In this container we use recompose and have the following code:

const enhance = compose(
      withProps({
        statuses: ['ordered', 'received'],
      }),
      withProps(
        // how do I pass props from this container to component ?
      ),
      withState('error', 'setError', false),
      withState('successAdded', 'setSuccessAdded', false),
      withState('loading', 'setLoading', false),
      withState('confirmModal', 'setConfirmModal', false),
...
export default enhance(ComponentForm);

How do we pass the props which belong to this container to our component ?

Upvotes: 2

Views: 3414

Answers (1)

CheapSteaks
CheapSteaks

Reputation: 5019

A component does not need to declare all the props it will receive via recompose HOCs to be able to use it (unless your are explicitly omitting props in your compose function via mapProps).

Pass the data as you would with a normal component, and have your child component use it as it would any normal prop

Upvotes: 6

Related Questions