question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Warning in IE 11 when using React.Fragment

See original GitHub issue

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

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

1reaction
ImanMhcommented, Jun 5, 2018

I passed fragment to a library and that library is trying to add class names to the fragment children. I think that’s why It happens to me.

0reactions
ImanMhcommented, Jun 5, 2018

@gaearon I use React ^16.3.2 an I yet have this problem and it’s not only IE but FF too. Is it possible that the issue still exists? How can I fix it and send a pr?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fragments - React
Fragments let you group a list of children without adding extra nodes to the DOM. There is also a new short syntax for...
Read more >
Warning IE11 users their browser is unsupported in React 18
Currently we use react-app-polyfill as well as bowser to check if users are using a supported browser, and show a simple alert if...
Read more >
eslint-plugin-react - npm
React specific linting rules for ESLint. Latest version: 7.31.11, last published: a month ago. Start using eslint-plugin-react in your ...
Read more >
React Fragments Sarah Chima - Front-End Developer
Fragments let you group a list of children without adding extra nodes to the DOM. We use it exactly the same way we...
Read more >
ReactJS Version - javatpoint
SN Version Release Date 1. 0.3.0 29/05/2013 2. 0.4.0 20/07/2013 3. 0.5.0 20/10/2013
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found