Warning in IE 11 when using React.Fragment
See original GitHub issueDo 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:
- Use
create-react-app
to create a new React app. - Add
<React.Fragment>
toApp.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;
- Open the app in IE 11.
- Open IE dev tools and refresh the browser.
- 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:
- Created 5 years ago
- Reactions:3
- Comments:14 (12 by maintainers)
Top 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 >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
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.
@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?