clauderic / clauderic/react-sortable-hoc

How to do propTypes check after HOC

Open
#327 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
10.9k
Forks
959
PR merge metrics
No merged PRs in 30d

Description

I use `SortableContainer` as follow:
```
const CustomAutoActionFieldFormStepList = SortableContainer(({ steps, onActionSort }) => (


{
console.log(steps)
}
{ steps.map((step, index) => (

))}

));
```
and then i want add a propTypes check like this:
```
FieldFormStepList.propTypes ={
steps: PropTypes.array,
doActionSort: PropTypes.fun
};
```
but there are some fault:
- Invalid prop `steps` of type `object` supplied to `sortableList`, expected `array`.
- prop type `doActionSort` is invalid; it must be a function

I am quite sure that the props of `steps` is a array, and `doActionSort` is a function.
So is `SortableContainer ` changed the default props? if so, how can check CustomAutoActionFieldFormStepList 's props.

tip: the `steps` after console.log is:
`{_isFieldArray: true, forEach: ƒ, get: ƒ, getAll: ƒ, insert: ƒ, …}`

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.