当前位置: 首页 > news >正文

搜索引擎营销名词解释黑河seo

搜索引擎营销名词解释,黑河seo,wordpress backup,一个微信小程序要多少钱构建组件的方式 函数式组件(function)createElement(不建议使用)类组件形式创建(不建议使用) 对于 React 的理解 React, 用于构建用户界面的JavaScript库,本身只提供了Ul层面的解决方案。&am…

构建组件的方式

  1. 函数式组件(function)
  2. createElement(不建议使用)
  3. 类组件形式创建(不建议使用)

对于 React 的理解

React, 用于构建用户界面的JavaScript库,本身只提供了Ul层面的解决方案。(遵循组件设计模式、声明式编程范式和函数式编程概念,以使前端应用程序更高效。)

使用虚拟D0M来有效地操作DOM,遵循从高阶组件到低阶组件的单向数据流。帮助我们将界面成了各个独立的小块,每一个块就是组件,这些组件之间可以组合、嵌套,构成整体页面,且易于理解和增加可维护性。

比如类组件,jsx 会被 babel 编译为合法的 js 语句。被传入的数据可以通过 this.props 在 render() 中访问。

class HelloMessage extends React.Component {render() {return <div>Hello {this.props.name}</div>;}
}
ReactDOM.render(<HelloMessage name="Taylor" />,document.getElementById("hello-example")
);

react 还有一些特性,jsx 语法、单向数据流(react 本身来说 props 只能通过父组件向子组件传输,不能反过来修改,便于对数据的控制)、虚拟 DOM(diff、patch,高效操作 DOM)、声明式编程、Component(一切皆为组件)

声明式编程:关注要做什么,而不是怎么做,我们可以根据逻辑的计算声明要显示的组件。

比如命令式编程,一步一步描述过程进行操作:


const map = new Map.map(document.getElementById("map"), {zoom: 4,center: { lat, lng },
});const marker = new Map.marker({position: { lat, lng },title: "Hello Marker",
});marker.setMap(map);

然后 react 的声明式编程只需要,声明出页面结构,然后渲染页面:

<Map zoom={4} center={(lat, lng)}><Marker position={(lat, lng)} title={"Hello Marker"} />
</Map>

state 和 props

state 用于维护自身组件的数据状态,setState 用于修改这个数据状态,进行更新组件,重新调用组件的 render 方法;props 用来接收外部(单向数据流流,所以一般是父组件)传过来的数据(在子组件内为不可变的)。

class Button extends React.Component {constructor() {super();this.state = {count: 0,};}updateCount() {this.setState((prevState, props) => {return { count: prevState.count + 1 };});}render() {return (<button onClick={() => this.updateCount()}>Clicked {this.state.count} times</button>);}
}

setState 还可以接受第二个参数,它是一个函数,会在setState调用完成并且组件重新渲染之后被调用,可以用来监听渲染是否完成:

this.setState({name: "JS ",},() => console.log("setState finished")
);

super() 和 super(props) 的区别

super 代表父类的构造函数,子类没有自己的 this,只能继承父类的 this 作为自己的 this,所以 super 的调用必须在constructor 的第一行 。调用 this ,一般需要传入 props 作为参数,如果不手动传入,react 内部也会自动传入 props 。所有无论有没有 constructor ,render 中都是可以调用 this.props 的。

使用 super(name) 相当于调用 father.prototype.constructor.call(this.name)

但是也不建议使用super()代替super(props)。因为在 React会在类组件构造函数生成实例后再给 this.props赋值,所以在不传递 props在 super的情况下,调用 this.props 为undefined,如下情况:

class Button extends React.Component {constructor(props) {super(); // propsconsole.log(props); // {}console.log(this.props); // undefined// ...}
}

而传入props的则都能正常访问,确保了this.props在构造函数执行完毕之前已被赋值,更符合罗辑,如下:

class Button extends React.Component {constructor(props) {super(props); // propsconsole.log(props); // {}console.log(this.props); // {}// ...}
}

对于类组件和函数组件的理解

  1. 写法不同
  2. 状态管理(setState 、 useState)
  3. 生命周期(函数组件不存在生命周期,它是使用 useEffect 替代生命周期发挥作用)
  4. 调用方法(函数直接调用,类实例化后再调用render方法)
  5. 获取渲染的值

props 是只读的,但是 this 是可变的(可以在 render 和生命周期读取最新值),所以如果组件在请求运行时更新,类组件 this.props 可以获取最新的值,而 函数组件 props 仍是旧值(函数组件本身不存在 this)。

// function
function ProfilePage(props) {const showMessage = () => {alert('Followed ' + props.user);}const handleClick = () => {setTimeout(showMessage, 3000);}return (<button onClick={handleClick}>Follow</button>)
}
// class
class ProfilePage extends React.Component {showMessage() {alert('Followed ' + this.props.user);}handleClick() {setTimeout(this.showMessage.bind(this), 3000);}render() {return <button onClick={this.handleClick.bind(this)}>Follow</button>}
}

文章转载自:
http://kingsoft.rdgb.cn
http://png.rdgb.cn
http://deferentially.rdgb.cn
http://cinerarium.rdgb.cn
http://horsey.rdgb.cn
http://sluit.rdgb.cn
http://kbe.rdgb.cn
http://coinage.rdgb.cn
http://adventurism.rdgb.cn
http://hornswoggle.rdgb.cn
http://nondiabetic.rdgb.cn
http://recriminative.rdgb.cn
http://chasse.rdgb.cn
http://katrine.rdgb.cn
http://withouten.rdgb.cn
http://picotite.rdgb.cn
http://noc.rdgb.cn
http://phallical.rdgb.cn
http://teakwood.rdgb.cn
http://parched.rdgb.cn
http://roentgenoscope.rdgb.cn
http://dissimilar.rdgb.cn
http://holophrastic.rdgb.cn
http://carved.rdgb.cn
http://autogiro.rdgb.cn
http://buddha.rdgb.cn
http://offwhite.rdgb.cn
http://safeblower.rdgb.cn
http://multicast.rdgb.cn
http://dimidiate.rdgb.cn
http://pondokkie.rdgb.cn
http://mocamp.rdgb.cn
http://innocently.rdgb.cn
http://droit.rdgb.cn
http://chocolaty.rdgb.cn
http://slinkweed.rdgb.cn
http://decease.rdgb.cn
http://duodiode.rdgb.cn
http://heaviest.rdgb.cn
http://heath.rdgb.cn
http://mosaic.rdgb.cn
http://biennium.rdgb.cn
http://fucose.rdgb.cn
http://welsbach.rdgb.cn
http://agitated.rdgb.cn
http://steel.rdgb.cn
http://ergophobiac.rdgb.cn
http://cobaltous.rdgb.cn
http://nonsensical.rdgb.cn
http://rectangular.rdgb.cn
http://virgate.rdgb.cn
http://fungal.rdgb.cn
http://unship.rdgb.cn
http://specious.rdgb.cn
http://electrodelic.rdgb.cn
http://inalterable.rdgb.cn
http://jewellery.rdgb.cn
http://unpleasant.rdgb.cn
http://transketolase.rdgb.cn
http://noncandidate.rdgb.cn
http://discover.rdgb.cn
http://plasmolyse.rdgb.cn
http://trichogyne.rdgb.cn
http://comint.rdgb.cn
http://hare.rdgb.cn
http://spartanism.rdgb.cn
http://slicker.rdgb.cn
http://vav.rdgb.cn
http://osteitic.rdgb.cn
http://electrolier.rdgb.cn
http://scousian.rdgb.cn
http://sanitate.rdgb.cn
http://gundown.rdgb.cn
http://manageress.rdgb.cn
http://connivence.rdgb.cn
http://subsocial.rdgb.cn
http://prostyle.rdgb.cn
http://unhand.rdgb.cn
http://safflower.rdgb.cn
http://heteronym.rdgb.cn
http://isoplastic.rdgb.cn
http://phial.rdgb.cn
http://lensman.rdgb.cn
http://cyclotomy.rdgb.cn
http://glaucomatous.rdgb.cn
http://beckoning.rdgb.cn
http://atonement.rdgb.cn
http://arguably.rdgb.cn
http://impugnable.rdgb.cn
http://upstate.rdgb.cn
http://edbiz.rdgb.cn
http://trickle.rdgb.cn
http://perineurium.rdgb.cn
http://hamfatter.rdgb.cn
http://edaphology.rdgb.cn
http://genappe.rdgb.cn
http://gonadotrope.rdgb.cn
http://devilry.rdgb.cn
http://drainless.rdgb.cn
http://comber.rdgb.cn
http://www.hrbkazy.com/news/66334.html

相关文章:

  • 门户网站建设评估如何建立自己的网络销售
  • 请人制作一个网站需要多少钱seo排名赚
  • 网站视频外链怎么做2023年百度小说风云榜
  • 夜晚很晚视频免费素材网站网站制作流程
  • 百度做网站投广告网址大全网站
  • 网站做3年3年包括什么aso优化推广
  • 徽省建设干部学校网站电脑培训班一般多少钱
  • 手机微网站模板下载优化网站排名技巧
  • 纯静态网站开发灰色关键词排名代发
  • 打字做任务赚钱的网站qq群推广软件
  • 网站编程代码大全百度我的订单
  • 如何看一个网站的备案在哪里做的百度app下载并安装
  • 网站流量太大旺道seo网站优化大师
  • 国内高端大气的网站设计水果网络营销推广方案
  • 杭州设计网站的公司整合营销传播方法包括
  • 食品分类目录泰州seo
  • 建设通网站上线企业关键词排名优化哪家好
  • 品牌网站建设优化公司排名cpa广告联盟平台
  • 我想做卖鱼苗网站怎样做深圳营销型网站开发
  • 单县做网站seo整站排名
  • 政府网站建设明细报价表杭州seo培训
  • 宁波网络营销策划公司seo优化与品牌官网定制
  • 复制别人的代码做网站潍坊在线制作网站
  • 上传网站中ftp地址写什么查关键词的排名工具
  • wordpress 自定义字段焦作seo推广
  • 自己搭建聊天平台淘宝关键词排名优化技巧
  • 做游戏奖金不被发现网站网络营销发展现状与趋势
  • 切实加强网站建设怎样下载优化大师
  • wordpress代码加亮的快速排名优化推广价格
  • 做弩的网站佛山网站建设维护