If you are importing this component to another component, you must have getting this warning,
Warning: <commonFormModel /> is using incorrect casing. Use PascalCase for React components, or lowercase for HTML elements.
In JSX, lower-case tag names are considered to be HTML tags. However, lower-case tag names with a dot (property accessor) aren't.
<component />
compiles to React.createElement('component')
(html tag)
<Component />
compiles to React.createElement(Component)
(react component)
<obj.component />
compiles to React.createElement(obj.component)
(react component)
You must change classname to PascalCase
export default class commonFormModel extends Component { //Incorrect way
export default class CommonFormModel extends Component { //Correct way
And finally you can use your component like,
<CommonFormModel />
Note: If you don't have state
for your component, I suggest you to go for functional component
. If you think in future you may have state
to this component, then you can use a constructor
, but make sure while calling super()
, you should pass your props
to it like super(props)
, in your case you are missing that. Also see difference between super()
& super(this)
.