React模拟后台项目(一)入口文件配置

  • Post author:
  • Post category:其他


一、入口index文件 src/index.js

// 导入库
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import * as serviceWorker from './serviceWorker';
import {Provider} from 'react-redux';

import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';

// 导入仓库
import store from './store/index'

ReactDOM.render(
    <ConfigProvider locale={zhCN}>
      <Provider store={store}>
        <App />
      </Provider>
    </ConfigProvider>,
  document.getElementById('root')
);

// If you want your app to work offline and load faster, you can change
// unregister() to register() below. Note this comes with some pitfalls.
// Learn more about service workers: https://bit.ly/CRA-PWA
serviceWorker.unregister();

二、入口App文件 src/App.js

import React from 'react';
// import logo from './logo.svg';
import './App.css';
// 导入样式
import { GlobalStyle } from './static/reset';
// 导入UI组件
import { ConfigProvider } from 'antd';
import zhCN from 'antd/es/locale/zh_CN';
// 导入路由
import Router from './router/index';

function App() {
  return (
    <ConfigProvider locale={zhCN}>
      <GlobalStyle />
      <Router />
    </ConfigProvider>
  );
}

export default App;



版权声明:本文为weixin_46030044原创文章,遵循 CC 4.0 BY-SA 版权协议,转载请附上原文出处链接和本声明。