N
N
Nikolay Semenov2018-03-18 14:56:58
JavaScript
Nikolay Semenov, 2018-03-18 14:56:58

Where is the prop passed to the component?

Guys, hello everyone.
There is such a component

const DatePicker = connect()(({ dispatch, ...props }) => {
  console.log(props);
  return <DateRangeWithPresentFlag {...props} />;
});

it is passed to another component
<Fields
            names={[`${namePrefix}startDate`, `${namePrefix}endDate`]}
            namePrefix={namePrefix}
            component={DatePicker}
            isPresent={namePrefix === "currentAddress_"}
            required
            label={formatMessage(messages["LivingArrangement.Date"])}
          />

in addition to the listed props, there are still a lot that are not included in Fields
Where they come from I can’t understand

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DarthJS, 2018-04-16
@DarthJS

- DatePicker is passed to Fields
- Most likely it is called inside the Fields component (unless, of course, it is passed further and is called somewhere in the third knee)
- Accordingly, DatePicker accepts all props from the Fields component
- ...props: Read about the spread https:// developer.mozilla.org/en/docs/Web/JavaScript...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question