Open the road of react again

The preface is that I have really learned this stuff for a long time, but it is still not how? why? Because it is not enough, because there is no real understanding! Because of too many reasons, I lost it for a long time this time, and my heart is so tired~~react, hey hey,,,, no nonsense

The scaffolding of create-react-app, I installed it today, I want to commit suicide, because the network has not been able to work, and I can't change the Taobao mirror. Anyway, I have repeatedly operated it n times, and finally I don't know how to do it, so let's leave it at that!

sudo npm install -g create-react-app yarn

create-react-app your object_name

cd your boject_name

yarn statr  or npm statr

At this point, the browser will visit  http://localhost:3000/  , and the interface you see  Welcome to React is successful.

 

install yarn add antd --save

yarn run eject is to eject the configuration file

After yes, a new folder will appear  

 

Configure on-demand loading issues  

yarn add babel-plugin-import --save-dev install babel plugin

Add green part configuration

plugins: [ 
['import', [{ libraryName: "antd", style: 'css' }]],
],
remove @import '~antd/dist/antd.css' in css; restart the project, the style still exists , this is the part of loading


custom themes on demand, why can't you just cover it yourself? Try to cover it yourself later to see if it works

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325214724&siteId=291194637