Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/webpack/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/6/xamarin/3.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Reactjs 反应:Can';无法获取组件列表_Reactjs_Webpack_Reactstrap - Fatal编程技术网

Reactjs 反应:Can';无法获取组件列表

Reactjs 反应:Can';无法获取组件列表,reactjs,webpack,reactstrap,Reactjs,Webpack,Reactstrap,在react类中,我尝试将行组件添加到列表中,以便以后需要列出某些内容时使用。它向我返回错误: 函数作为子函数无效。如果返回组件而不是从渲染返回组件,则可能会发生这种情况。或者您可能想调用此函数而不是返回它 在另一个项目,我有相同的功能,但不同的工作 我对行使用WebPack和reactstrap 我的班级 import React, { Component } from 'react'; import {Row, Col, Container} from 'reactstrap'; clas

在react类中,我尝试将行组件添加到列表中,以便以后需要列出某些内容时使用。它向我返回错误:
函数作为子函数无效。如果返回组件而不是从渲染返回组件,则可能会发生这种情况。或者您可能想调用此函数而不是返回它

在另一个项目,我有相同的功能,但不同的工作

我对行使用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;
import React,{Component}来自'React';
从“reactstrap”导入{Row,Col,Container};
类测试扩展了组件{
建造师(道具){
超级(道具);
this.insert=this.insert.bind(this);
}
插入(){
var列表=[];
list.push(
测试数据

); 返回{list}; } render(){ 返回( {this.insert} ); } } 导出默认测试;
您可以试试这个

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;
import React,{Component}来自“React”;
从“reactstrap”导入{Row,Col,Container};
类MyComponent扩展组件{
插入(){
var列表=[];
list.push(
测试数据

); 退货清单; } render(){ 返回( {this.insert()} ); } } 导出默认MyComponent;