vue 对比 react 语法快速学习运用
// vue vs react<template>//对应 reactrender() {return (<div>xxxxx</div>);}</template><script>// 对应reactclass Xxx extends React.Component {xxxxxx}// 或者function Xxx()
·
// vue vs react
<template>
// 对应 react
render() {
return (
<div>
xxxxx
</div>
);
}
</template>
<script>
// 对应react
class Xxx extends React.Component {
xxxxxx
}
// 或者
function Xxx() {
xxxHooks
return (
<div>xxx</div>
);
}
</script>
<style>
// react 一般在同级目录新建 .css文件
</style>
// vs 数据更新
// vue
this.data = xxx ;
// react
this.setState({
xx:newXx
})
或Hooks
setHooks(xxxx)
// 其它生命周期个人感觉也差不多
更多推荐
所有评论(0)