import React from 'react'; import ReactDOM from 'react-dom'; import './index.css'; import App from './App'; import * as serviceWorker from './serviceWorker'; // 引入antd相关 import { LocaleProvider } from 'antd'; import zhCN from 'antd/lib/locale-provider/zh_CN'; import 'antd/dist/antd.css'; import { BrowserRouter } from 'react-router-dom'; import {Provider} from "react-redux"; import store from './store'; // ReactDOM.render(, document.getElementById('root')); ReactDOM.render(
, 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.tsx
import React, {Component} from 'react'; import './App.css'; import { Switch, Route } from 'react-router'; import { NavLink } from 'react-router-dom'; import { Layout } from 'antd'; import A from './pages/a'; import B from './pages/b'; import { Dispatch } from 'redux'; import { connect } from "react-redux"; const { Header, Footer, Sider, Content } = Layout; interface Props { cName: string, changeName?: any } interface State { name: string } class App extends Component { // constructor(props: Props){ // super(props); // } render() { console.log(this.props.cName); return (
import {createStore} from 'redux'; function toDo(state, action) { state = state || {name: 'tom'}; switch (action.type) { case 'CHANGE_NAME': return {...state, ...action.payload}; default: return state; } } let store = createStore(toDo); export default store;
page/a.tsx
import React, {Component} from 'react'; import { Button } from 'antd'; class A extends Component { render() { return (
) } } export default A;
page/b.tsx
import React, {Component} from 'react'; import { Avatar } from 'antd'; class B extends Component { render() { return (
本文对比了杜甫《喜晴》的两种英文翻译版本:a. Pleased with Sunny Weather 和 b. Rejoicing in Clearing Weather。a 版由 alexcwlin 翻译并经 Adam Lam 编辑,b 版则由哈佛大学的宇文所安教授 (Prof. Stephen Owen) 翻译。 ...
[详细]