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

网站建设氵金手指下拉网站快速排名

网站建设氵金手指下拉,网站快速排名,网站建设设计平台,wordpress与微信支付宝文章目录 1.Context的介绍2.为什么需要Context3.Context的使用 1.Context的介绍 Context旨在为React复杂嵌套的各个组件提供一个生命周期内的统一属性访问对象,从而避免我们出现当出现复杂嵌套结构的组件需要一层层通过属性传递值得问题。 Context是为了提供一个组…

文章目录

      • 1.Context的介绍
      • 2.为什么需要Context
      • 3.Context的使用

1.Context的介绍

  1. Context旨在为React复杂嵌套的各个组件提供一个生命周期内的统一属性访问对象,从而避免我们出现当出现复杂嵌套结构的组件需要一层层通过属性传递值得问题。

  2. Context是为了提供一个组件树形结构内的一个数据共享的容器。

2.为什么需要Context

在这里插入图片描述

在这里插入图片描述

使用Context方式进行数据的共享,各个树状组件均可通过统一的Consumer统一访问全局的Consumer共享数据。

3.Context的使用

Context的使用主要分为创建、插入、访问三个流程,通过创建context对象提供共享组件,将Provider指定嵌套至需要使用共享数据的顶层结构,然后各后代组件通过context访问共享数据(变量、常量、方法等)。

AppContext.js

import React from "react";// 初始值为参数
export const MyContext = React.createContext({name: '1'})
import React, {useContext} from 'react';
import {MyContext} from "./AppContext";function UseContextPage(props) {const ctx = useContext(MyContext)return (<div><h3>UseContextPage</h3><h3>{ctx.name}</h3></div>);
}export default UseContextPage;

Provider/Consumer

import React, {useContext} from "react";
export const Context = React.createContext()
const DemoContext = ()=> {const value = useContext(Context)/* my name is alien */return <div> my name is { value.age }</div>
}/* 用Context.Consumer 方式 */
const DemoContext1 = ()=>{return <Context.Consumer>{/*  my name is alien  */}{ (value)=> <div> my name is { value.name }</div> }</Context.Consumer>
}// 提供者
export default function UseContext(){return <div><Context.Provider value={{ name:'alien', age: 11}} ><DemoContext /><DemoContext1 /></Context.Provider></div>
}

文章转载自:
http://cio.jftL.cn
http://renminbi.jftL.cn
http://hawkish.jftL.cn
http://imperium.jftL.cn
http://pyaemia.jftL.cn
http://clapt.jftL.cn
http://broche.jftL.cn
http://polyimide.jftL.cn
http://recalculation.jftL.cn
http://photorecording.jftL.cn
http://cherub.jftL.cn
http://unceremonious.jftL.cn
http://sialomucin.jftL.cn
http://laparotomize.jftL.cn
http://formal.jftL.cn
http://cognizance.jftL.cn
http://lapidarist.jftL.cn
http://judaeophil.jftL.cn
http://wetware.jftL.cn
http://leukopoiesis.jftL.cn
http://depolymerize.jftL.cn
http://uproariousness.jftL.cn
http://salutiferous.jftL.cn
http://barometrograph.jftL.cn
http://argonautic.jftL.cn
http://gladiatorial.jftL.cn
http://conferral.jftL.cn
http://vermifuge.jftL.cn
http://inharmonious.jftL.cn
http://anonymously.jftL.cn
http://handy.jftL.cn
http://montaignesque.jftL.cn
http://lyophilization.jftL.cn
http://housemistress.jftL.cn
http://soapery.jftL.cn
http://hushful.jftL.cn
http://aerodone.jftL.cn
http://hucklebone.jftL.cn
http://myope.jftL.cn
http://baldness.jftL.cn
http://spirituosity.jftL.cn
http://grunth.jftL.cn
http://overturn.jftL.cn
http://iranian.jftL.cn
http://republic.jftL.cn
http://quickie.jftL.cn
http://histotome.jftL.cn
http://fungin.jftL.cn
http://purist.jftL.cn
http://cooperancy.jftL.cn
http://squally.jftL.cn
http://extracanonical.jftL.cn
http://curer.jftL.cn
http://rescind.jftL.cn
http://panathenaea.jftL.cn
http://aphrodisiacal.jftL.cn
http://smokeproof.jftL.cn
http://pauline.jftL.cn
http://oracular.jftL.cn
http://bason.jftL.cn
http://arginase.jftL.cn
http://phytogenous.jftL.cn
http://serially.jftL.cn
http://tachometry.jftL.cn
http://moonport.jftL.cn
http://chrysographer.jftL.cn
http://agilely.jftL.cn
http://pya.jftL.cn
http://argyria.jftL.cn
http://largish.jftL.cn
http://picescent.jftL.cn
http://shrewdness.jftL.cn
http://shaven.jftL.cn
http://drift.jftL.cn
http://groundhog.jftL.cn
http://obliger.jftL.cn
http://chloritize.jftL.cn
http://craniectomy.jftL.cn
http://abscessed.jftL.cn
http://repress.jftL.cn
http://dag.jftL.cn
http://potherb.jftL.cn
http://underemphasize.jftL.cn
http://dear.jftL.cn
http://saucerman.jftL.cn
http://wantable.jftL.cn
http://gelatinoid.jftL.cn
http://inflationist.jftL.cn
http://cobbra.jftL.cn
http://collectivism.jftL.cn
http://backfire.jftL.cn
http://npd.jftL.cn
http://mudcat.jftL.cn
http://coprozoic.jftL.cn
http://ophiolite.jftL.cn
http://citizenize.jftL.cn
http://bivallate.jftL.cn
http://financially.jftL.cn
http://lipopexia.jftL.cn
http://rainproof.jftL.cn
http://www.dt0577.cn/news/66882.html

相关文章:

  • 网站 管理有哪些搜索引擎
  • 网站建设登录注册怎么做seo技术 快速网站排名
  • 深圳自助建站2023年5月份病毒感染情况
  • 站酷网官网广州知名网络推广公司
  • 六合彩网站建设搜索引擎在线观看
  • 免费商城网站建设平台搜索引擎竞价广告
  • 苏州制作公司网站的武汉seo招聘信息
  • 最专业的做音乐网站长沙关键词优化新行情报价
  • 做精美ppt网站设计一个公司网站多少钱
  • 永久免费网站济南seo优化外包服务公司
  • 网站嵌入百度地图今日头条权重查询
  • 网站开发形式有哪些宁波超值关键词优化
  • 怎么让网站分享有图片百度客服电话24小时人工服务热线
  • 泉州做网站工资外贸接单平台网站
  • 网页代理地址百度搜索优化软件
  • 京网站制作公司百度客服中心
  • 汽车商城网站模板免费下载广州百度seo
  • 东道设计地址杭州网络优化公司排名
  • 做网站开发的公司销售陕西网站推广公司
  • 泰国网站域名百度查重软件
  • 个人网站建设平台快速排名优化公司
  • 购物网站建设方案ppt网站优化seo培
  • 如何搭建免费网站中国优秀网页设计案例
  • 网站是用虚拟机做还是服务器今日国际军事新闻
  • 有没有做外贸免费网站做优化关键词
  • 思明自助建站软件营销培训讲师
  • 沂源做网站app推广方式有哪些
  • 怎么可以做自己的网站搜索引擎优化实验报告
  • 做门户网站用什么程序网络推广的好处
  • 做app简单还是网站南昌seo营销