The difference react with vue

This article is for the latest version react with vue to differentiate between the two languages at . (GitHub Address: https://github.com/OmegaMibai )

 

1, different initialization method

React:this.state={}

Vue :    data(){return{   }}

 

2, different routing mode jump

React:this.props.history.puth('   ')

Vue:     this.$router.puth('   ')

 

3, the address bar to obtain different parametrically

React:this.props.match.params('   ')

Vue:     this.$router.params('   ')

 

4, different ways to modify the model data

React: this.setState ({variable name: value})

Vue:. This variable name = value

 

5, data binding

React: Pure-way data flow

Vue: two-way data binding

 

6, build tools different

React:Create React App 

View:-cli

 

7, data is variable

React: Data immutable (immutable). react will re-take after setState rendering process, if shouldComponentUpdate returns true, it continues to play, if returned false, it will not re-render ( for large applications ).

vue:      data variable (responsive). By establishing Watcher to listen to each property, when property changes, responsive updates the corresponding virtual dom.

 

8, template rendering

R & lt EACT: generating HTML by js, i.e. JSX (design concept: all in js).

V UE:    the html, css, js combined together, with each processing mode, a single file VUE component, can html, css, js written to a file, html template engine is provided to process.

 

9, Life Cycle different

React:

 componentWillMountcomponentDidMountcomponentWillReceivePropsshouldComponentUpdatecomponentWillUpdatecomponentDidUpdatecomponentWillUnmount

 

 

V ue:

beforeCreateCreatedbeforeMountmountedbeforeUpdateupdatedbeforeDestroydestroyed

 

10, different configurations of routing manner

React:

V ue:

 

 

Guess you like

Origin blog.csdn.net/qq_38383650/article/details/84393842