В моем классе реакции я пытаюсь добавить компонент 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
для строки.
Мой класс
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;