小编itg*_*234的帖子

为什么IE 11显示空白页面渲染应用程序

我的IE 11和我的react应用有问题。我使用Webpack,babel和polyfill.io cdn,在渲染捆绑文件之前一切都很好,然后它停止执行任何操作。您知道什么地方可能出问题吗?

提前致谢。

javascript internet-explorer rendering polyfills reactjs

14
推荐指数
5
解决办法
2万
查看次数

必须返回有效的React元素(或null).您可能已返回undefined,数组或其他一些无效对象

我是ReactJS的新手,我遇到了问题.我无法解决它.似乎一切都很好,但仍然控制台让我:

必须返回有效的React元素(或null).您可能已返回undefined,数组或其他一些无效对象.

这是我的代码:

import React from 'react';
import ReactDOM from 'react-dom';
import fetch from 'isomorphic-fetch';
import Pokemon from './Pokemon';

class PokemonList extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      species: [],
      fetched: false,
      loading: false,
    };
  }
  componentWillMount(){
    this.setState({
      loading : true
    });
    fetch('http://pokeapi.co/api/v2/pokemon?limit=151').then(res => res.json())
    .then(res =>{
      this.setState({
        species : res.results,
        loading : true,
        fetched : true
      });
    });
  }
  render() {
    const {fetched, loading, species} = this.state;
    let content;
    //This if seems to be the problem
    if(fetched){ …
Run Code Online (Sandbox Code Playgroud)

reactive-programming reactjs

8
推荐指数
2
解决办法
1万
查看次数