javascript - React.createElement: type is invalid when using array.map inside a stateless component -
i have following component:
import react "react"; import { grid, form } "semantic-ui-react"; const basicdetail = ({detaildata}) => { return( <div> <grid.row> <h3>basic details</h3> {detaildata.map((form) => { return ( <form.input label={form.label} readonly={true} defaultvalue={form.default} type="text" /> ) })} </grid.row> </div> ) } basicdetail.proptypes = { detaildata: react.proptypes.array.isrequired }; export default basicdetail;
i passing array of objects in props, getting following error:
warning.js:36 warning: react.createelement: type invalid -- expected string (for built-in components) or class/function (for composite components) got: undefined. forgot export component file it's defined in. check render method of
basicdetail
.
if remove .map function component renders correctly.
what cause of error?
semantic ui react
components names starts capital letter.
use form.input
instead of form.input
.
Comments
Post a Comment