# react
**Repository Path**: mmr123/react
## Basic Information
- **Project Name**: react
- **Description**: react添砖加瓦
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-02-13
- **Last Updated**: 2020-12-20
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
## Available Scripts
In the project directory, you can run:
### `yarn start`
### react-router使用文档
### 1.函数跳转
### 2.路由传参
this.props.history.push({pathname:"/check/" + urlParme});
componentDidMount() {
console.log(this.props.match.params.pickname;);
}
### 3.隐式传参
``
`componentDidMount() {//console.log(this.props.match.params);console.log(this.props.history.location.state);}`
### 4.直接获取URL参数
`getUrlToken(name, str) {
const reg = new RegExp(`(^|&)${ name}=([^&]*)(&|$)`);
const r = str.substr(1).match(reg);
if (r != null) return decodeURIComponent(r[2]); return null;
}`
调用:`getUrlToken('name',props.location.search)`
### 5.组件传参 父->子
父:
子:this.props.content
### 6.组件传参 子->父
子:
`this.props.onValue(value)`
父:
``
`getChildValue(value){}`