-
Notifications
You must be signed in to change notification settings - Fork 47.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Warning in IE 11 when using React.Fragment #12500
Comments
Want to look into why this happens? |
In
With IE 11, after the above statement, the size of Because of this, the following function outputs the warning:
|
How are you polyfilling Map? This seems like maybe the same issue as [on a phone can't find the other issue], where the problem was ie11's Map is broken for ctor arguments like this |
Ugh right. Not our first time bumping into this, maybe it’s time to add an internal rule against Map/Set constructor argument. Do you want to send a fix? |
The thing is, we don’t require Map to be polyfilled on IE11 because it already exists there. We just need to avoid constructor arguments in our code. |
Could also do a quick test when check for broken Map implementations. Avoiding the ctor argument is easy enough for React, too. It might nicer for the ecosystem to insist on a valid Map, since libraries will be using Map/Set more assuming the React env baseline. |
Browser compatibility table shows that https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map I tried the following code and it makes the warning go away.
|
Let’s just replace this with two string literal comparisons. I don’t see why the Map here is useful. |
This brings up a broader question on how to handle bad native implementations. These cases are easy enough to refactor, but what happens when we really want to use a Map/Set/etc. feature that isn't available in some native implementations? Does it make sense to ask users to polyfill for bad native behavior too? |
We decide this on a case by case basis. In case of Map/Set we're happy with IE11 feature set (afaik), we just keep forgetting about it. |
Fixed in 16.3.1 |
@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? |
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. |
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:Steps to reproduce:
create-react-app
to create a new React app.<React.Fragment>
toApp.js
. For example: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
The text was updated successfully, but these errors were encountered: