React17配置

*搭建项目:

1.npx create-react-app my-app

npx create-react-app my-app --template typescript    //支持typesrcipt

2.npm install

3.启动项目: npm start

*插件: react-icons --在button中添加图标

*插件: jwt-decode --解析jwt token的插件

*插件:react-credit-cards --一个react的信用卡插件,提供了内置样式,支付功能等

*插件:typescript-plugin-css-modules --save-dev   一个TypeScript语言服务插件,提供对CSS模块的支持-源码

typescript-plugin-css-modules的配置

1.在tsconfig.ts中:

{
    "compilerOptions": {
        "jsx":"react-jsx",
        "noImplicitAny": false,
        "plugins":[
            {
                "name":"typescript-plugin-css-modules"
            }
        ],
        "esModuleInterop": true
    }
    
}

2.创建settings.json:

加入

{

    "typescript.tsdk": "node_modules/typescript/lib",

    "typescript.enablePromptUseWorkspaceTsdk": true

}

*typescript自动映射any的配置:

*React-router:

安装:

npm install react-router-dom

如果需要React-router支持Typescript,还需安装:

npm install @types/react-router-dom --save-dev

引入全局scss

npm i sass-resources-loader --save-dev 
yarn run eject
{
    test: sassModuleRegex,
    use: getStyleLoaders(
        {
            importLoaders: 3,
            sourceMap: isEnvProduction
                ? shouldUseSourceMap
                : isEnvDevelopment,
            modules: {
                getLocalIdent: getCSSModuleLocalIdent,
            },
        },
        'sass-loader'
    )
},

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值