Skip to content

Warning in IE 11 when using React.Fragment #12500

Closed
@heikkilamarko

Description

@heikkilamarko

Do you want to request a feature or report a bug?

bug

What is the current behavior?

With React 16.3.0, when using <React.Fragment> IE 11 gives the following warning:

Warning: Invalid prop `children` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.

Steps to reproduce:

  1. Use create-react-app to create a new React app.
  2. Add <React.Fragment> to App.js. For example:
import React, { Component } from "react";
import logo from "./logo.svg";
import "./App.css";

class App extends Component {
  render() {
    return (
      <div className="App">
        <React.Fragment>
          <header className="App-header">
            <img src={logo} className="App-logo" alt="logo" />
            <h1 className="App-title">Welcome to React</h1>
          </header>
          <p className="App-intro">
            To get started, edit <code>src/App.js</code> and save to reload.
          </p>
        </React.Fragment>
      </div>
    );
  }
}

export default App;
  1. Open the app in IE 11.
  2. Open IE dev tools and refresh the browser.
  3. You should see the above mentioned warning message in the console window.

No warnings with Chrome, Firefox, and Edge.

What is the expected behavior?

There should be no warnings shown.

Which versions of React, and which browser / OS are affected by this issue? Did this work in previous versions of React?

React: 16.3.0
Browser: IE 11
OS: Windows 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions