В моем классе реакции я пытаюсь добавить компонент Row в список на потом, когда мне нужно будет что-то перечислить. Он возвращает мне эту ошибку: Functions are not valid as a React child. This may happen if you return a Component instead of <Component /> from render. Or maybe you meant to call this function rather than return it
В другом проекте у меня такая же функция, но она работает по-другому.
Я использую WebPack и reactstrap для Row.
Мои занятия
import React, { Component } from 'react';
import {Row, Col, Container} from 'reactstrap';
class Test extends Component {
constructor(props) {
super(props);
this.insert = this.insert.bind(this);
}
insert() {
var list = [];
list.push(
<Row>
<Col>
<p>Test data</p>
</Col>
</Row>);
return {list};
}
render() {
return (
<div>
<Container>
{this.insert}
</Container>
</div>
);
}
}
export default Test;





Вы можете попробовать это
import React, { Component } from "react";
import { Row, Col, Container } from "reactstrap";
class MyComponent extends Component {
insert() {
var list = [];
list.push(
<Row>
<Col>
<p>Test data</p>
</Col>
</Row>
);
return list;
}
render() {
return (
<div>
<Container>{this.insert()}</Container>
</div>
);
}
}
export default MyComponent;