Answer the question
In order to leave comments, you need to log in
How to dynamically connect components in ReactJS?
There is this code:
import React, {useState, useEffect} from 'react';
import { Container } from 'react-grid-system';
import Header from '../../ui/header';
import Footer from '../../ui/footer';
export default (props) => {
const DynPage = require('./' + props.name);
return(
<div>
<Header />
<Container>
<DynPage />
</Container>
<Footer />
</div>
)
}
Warning: React.createElement: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object.
Uncaught Invariant Violation: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object.
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question