[React] --- react in the decorator (use of higher-order upgrade components)

 

A, creact-react-app the decorator

 

  • Run npm run eject allows configuration items created by the create-react-app items exposed

  • At this point, the project more than a config file, and each profile has been exposed. (Before you run npm run eject, to ensure that no local files to be submitted to git)

  • Babel plug-in installationnpm install --save-dev @babel/plugin-proposal-decorators

  • Babel modify configuration file entries package.json

    Copy the code
    "babel": {
        "plugins": [
          ["@babel/plugin-proposal-decorators", { "legacy": true }]
        ],
        "presets": [
          "react-app"
        ]
      }
     
  •  

Guess you like

Origin www.cnblogs.com/yuanjili666/p/11617154.html