This time I will bring you a summary of Reactroutingjump methods, and what are the notes for React route jumps. The following is a practical case, let’s take a look.
Preface
React-Router has been released in multiple versions, and there are not many ways to use routingNavigation Same, let’s summarize it here.
React-Router 2.0.0 version
2.0.0 version needs to use browserHistory to jump, please refer to the code for details:
import { browserHistory } from 'react-router' browserHistory.push('/path')
React-Router version 2.4.0 or above
React-Router version 2.4.0 or above, you can add this to the component through the mixin method. routerAttribute, and then perform the corresponding operation. The specific mixin code reference is as follows:
import { withRouter } from 'react-router'; clsss ABC extends Component { } module.exports = withRouter(ABC);
Components that have used mixin will have the attribute of this.router, and only need to use this.props.router .push('/path') can jump to the corresponding route.
React-Router version 3.0.0 or above
After version 3.0.0, there is no need to manually mixin related router attributes. Write this.props.router.push('/path') in the jumped component to jump to the corresponding route.
React-Router version 4.0 and above
Routing jump
React-Router 4.0 has improved routing. The router attribute has been changed to the history attribute, and the usage method is still the same as in 3.0. Anywhere that needs to be jumped, use this.props.history.push('/path')
to jump.
Getting parameters
Use this.props.match.params.xxx
You can get the parameters of the current route
I believe you have mastered the method after reading the case in this article , for more exciting content, please pay attention to other related articles on the php Chinese website!
Recommended reading:
Detailed explanation of the case of using Vue.js download method
How to operate Node.js and use the dialog box ngDialog
The above is the detailed content of Summary of React routing jump methods. For more information, please follow other related articles on the PHP Chinese website!

在react中,canvas用于绘制各种图表、动画等;可以利用“react-konva”插件使用canvas,该插件是一个canvas第三方库,用于使用React操作canvas绘制复杂的画布图形,并提供了元素的事件机制和拖放操作的支持。

在react中,antd是基于Ant Design的React UI组件库,主要用于研发企业级中后台产品;dva是一个基于redux和“redux-saga”的数据流方案,内置了“react-router”和fetch,可理解为应用框架。

React不是双向数据流,而是单向数据流。单向数据流是指数据在某个节点被改动后,只会影响一个方向上的其他节点;React中的表现就是数据主要通过props从父节点传递到子节点,若父级的某个props改变了,React会重渲染所有子节点。

因为在react中需要利用到webpack,而webpack依赖nodejs;webpack是一个模块打包机,在执行打包压缩的时候是依赖nodejs的,没有nodejs就不能使用webpack,所以react需要使用nodejs。

react是组件化开发;组件化是React的核心思想,可以开发出一个个独立可复用的小组件来构造应用,任何的应用都会被抽象成一颗组件树,组件化开发也就是将一个页面拆分成一个个小的功能模块,每个功能完成自己这部分独立功能。

react和reactdom的区别是:ReactDom只做和浏览器或DOM相关的操作,例如“ReactDOM.findDOMNode()”操作;而react负责除浏览器和DOM以外的相关操作,ReactDom是React的一部分。

在react中,forceupdate()用于强制使组件跳过shouldComponentUpdate(),直接调用render(),可以触发组件的正常生命周期方法,语法为“component.forceUpdate(callback)”。

react中没有双向绑定;react的设计思想就是单向数据流,没有双向绑定的概念;react是view层,单项数据流只能由父组件通过props将数据传递给子组件,满足了view层渲染的要求并且更易测试与控制,所以在react中没有双向绑定。


Hot AI Tools

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Undress AI Tool
Undress images for free

Clothoff.io
AI clothes remover

AI Hentai Generator
Generate AI Hentai for free.

Hot Article

Hot Tools

Atom editor mac version download
The most popular open source editor

Dreamweaver Mac version
Visual web development tools

VSCode Windows 64-bit Download
A free and powerful IDE editor launched by Microsoft

SAP NetWeaver Server Adapter for Eclipse
Integrate Eclipse with SAP NetWeaver application server.

EditPlus Chinese cracked version
Small size, syntax highlighting, does not support code prompt function