Home > Web Front-end > JS Tutorial > body text

What should I do if Huawei browser cannot open react?

藏色散人
Release: 2022-12-30 11:13:23
Original
2116 people have browsed it

The solution to the problem that Huawei browser cannot open react: first install babel-polyfill; then introduce babel-polyfill where react is mounted or use configuration items to load polyfill on demand.

What should I do if Huawei browser cannot open react?

The operating environment of this tutorial: windows7 system, react17.0.1 version, Dell G3 computer.

What should I do if Huawei browser cannot open the react page?

Pages written using react can be displayed normally in other browsers, but they appear blank in the built-in browser of Huawei Honor mobile phones.

The solution is as follows:

1. Install babel-polyfill

npm install --save babel-polyfill
Copy after login

2. Where react is mounted, before introducing react, introduce babel-polyfill

import 'babel-polyfill';
import React from 'react'
import ReactDOM from 'react-dom'
ReactDOM.render(
  ,
  document.getElementById('app')
)
Copy after login

If the above method does not work, is the babel too high?

After version 7 of babel, it has been abandoned

Use configuration items to load polyfill on demand

Add the following configuration to .babelrc:

{
    "presets": [
        [
            "@babel/preset-env",
            {
                "useBuiltIns": "entry",
                 "corejs": 3
            }
        ]
    ]
}
Copy after login

Related recommendations: "react video tutorial"

The above is the detailed content of What should I do if Huawei browser cannot open react?. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact [email protected]
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!