153
rated 0 times
[
158]
[
5]
/ answers: 1 / hits: 9945
/ 5 Years ago, mon, november 25, 2019, 12:00:00
I have an array of objects
[
{
id: 1,
customtitle: '',
IconSRC: '',
btnColor: '',
inlineSyle: '',
btnStyle: {
width: '100px',
height: '100px',
flexDirection: 'column',
},
num: 1,
},
{
id: 2,
customtitle: '',
IconSRC: '',
btnColor: '',
inlineSyle: '',
btnStyle: {
width: '100px',
height: '100px',
flexDirection: 'column',
},
num: 2,
},]
and i confused to making it work as props validation .I need help to fix it, I try this way
Function.propTypes = {
list: PropTypes.objectOf(PropTypes.shape({
id: PropTypes.number,
btnColor: PropTypes.string,
customTitle: PropTypes.string,
btnStyle:PropTypes.object
IconSRC: PropTypes.string,
inlineSyle: PropTypes.string,
})),
};
Function.defaultProps = {
List: [],
};
But that didn't work.
without this proptypes my component works correctly. but eslint show an error with this text
.map' is missing in props validation eslint(react/prop-types)
More From » reactjs