-Install
npm install -g create-react-app
-create
js: create-react-app my-app
ts: create-react-app survey --template typescript
-Start
yarn start
npm run start
binding:
class TodoList extends Component {
constructor(props) {
super(props);
this.state = {
inputValue: '11',
list: []
}
}
render() {
return (
<div>
<input value = {this.state.inputValue} />
<button>提交</button>
<ul>
<li>English</li>
<li>Chinese</li>
</ul>
</div>
)
}
}
-ajax request
yarn add axios
-charles proxy - mock json response
-antd
yarn add antd
-redux
yarn add redux
-create store
create folder store under src
create index.js under store
-react-redux
yarn add react-redux
-styled-component
yarn add styled-components
-testing
Error: cannot import module
revise "test": "react-scripts test --transformIgnorePatterns \"node_modules/(?!@codemirror)/\"",
add "coverage": "yarn test —coverage --watchAll"
in package.json
and then can run: yarn coverage
it will then display all the coverage
or run: yarn test
yarn build issues:
Comments
Post a Comment