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

网站制作将栏目分类现在推广用什么平台

网站制作将栏目分类,现在推广用什么平台,二维码小程序制作,公众号背景图怎么制作PortalComponent 1 )概述 React Portal之所以叫Portal,因为做的就是和“传送门”一样的事情render到一个组件里面去,实际改变的是网页上另一处的DOM结构主要关注 portal的创建, 调和, 更新过程 2 )源码 定位到 packages/react-…

PortalComponent


1 )概述

  • React Portal之所以叫Portal,因为做的就是和“传送门”一样的事情
  • render到一个组件里面去,实际改变的是网页上另一处的DOM结构
  • 主要关注 portal的创建, 调和, 更新过程

2 )源码

定位到 packages/react-dom/src/client/ReactDOM.js#L576

function createPortal(children: ReactNodeList,container: DOMContainer,key: ?string = null,
) {invariant(isValidContainer(container),'Target container is not a DOM element.',);// TODO: pass ReactDOM portal implementation as third argumentreturn ReactPortal.createPortal(children, container, null, key);
}
  • 这里调用的是 ReactPortal.createPortal, 进入

    // packages/shared/ReactPortal.js#L14
    export function createPortal(children: ReactNodeList,containerInfo: any,// TODO: figure out the API for cross-renderer implementation.implementation: any,key: ?string = null,
    ): ReactPortal {return {// This tag allow us to uniquely identify this as a React Portal$$typeof: REACT_PORTAL_TYPE,key: key == null ? null : '' + key,children,containerInfo, // dom 挂载节点implementation,};
    }
    
    • 这里返回一个对象,类似于 ReactElement
    • 区别在于 $$typeofcontainerInfo 需要的挂载点
  • 对于 REACT_PORTAL_TYPE 类型的组件在 reconcile 时, 看下具体操作, 找到 reconcileSinglePortal

    // packages/react-reconciler/src/ReactChildFiber.js#L1171
    function reconcileSinglePortal(returnFiber: Fiber,currentFirstChild: Fiber | null,portal: ReactPortal,expirationTime: ExpirationTime,
    ): Fiber {const key = portal.key; // 当前的 keylet child = currentFirstChild;// 如果 存在 child, 对比 child.key === keywhile (child !== null) {// TODO: If key === null and child.key === null, then this only applies to// the first item in the list.if (child.key === key) {// 关注这里,有 containerInfo 的对比,portal 需要关心渲染到的节点是否有变化// 如果节点有变化,那么这个 portal 的渲染过程也会有变化// 都符合,说明老节点都可以复用if (child.tag === HostPortal &&child.stateNode.containerInfo === portal.containerInfo &&child.stateNode.implementation === portal.implementation) {deleteRemainingChildren(returnFiber, child.sibling); // 删除其他节点// 通过 useFiber 复用这个节点const existing = useFiber(child,portal.children || [],expirationTime,);existing.return = returnFiber;return existing;} else {// key相同,但是不符合上述if, 没法复用,删除干净deleteRemainingChildren(returnFiber, child);break;}} else {// key 不同,删除当前节点deleteChild(returnFiber, child);}child = child.sibling;}// 创建一个 portal 的 fiber 对象const created = createFiberFromPortal(portal,returnFiber.mode,expirationTime,);created.return = returnFiber;return created;
    }
    
  • 对于更新一个portal节点,进入 updatePortalComponent

    // packages/react-reconciler/src/ReactFiberBeginWork.js#L1322
    function updatePortalComponent(current: Fiber | null,workInProgress: Fiber,renderExpirationTime: ExpirationTime,
    ) {// 挂载点处理pushHostContainer(workInProgress, workInProgress.stateNode.containerInfo);const nextChildren = workInProgress.pendingProps; // 这里 pendingProps 是 childrenif (current === null) {// Portals are special because we don't append the children during mount// but at commit. Therefore we need to track insertions which the normal// flow doesn't do during mount. This doesn't happen at the root because// the root always starts with a "current" with a null child.// TODO: Consider unifying this with how the root works.workInProgress.child = reconcileChildFibers(workInProgress,null,nextChildren,renderExpirationTime,);} else {reconcileChildren(current,workInProgress,nextChildren,renderExpirationTime,);}return workInProgress.child;
    }
    
    • 之前梳理过的 API 不再赘述
    • 一些API的调用,在源码的注释中

文章转载自:
http://nowhere.zfqr.cn
http://wilton.zfqr.cn
http://unreal.zfqr.cn
http://injectable.zfqr.cn
http://mozarab.zfqr.cn
http://heatronic.zfqr.cn
http://neutralisation.zfqr.cn
http://arytenoidal.zfqr.cn
http://benorth.zfqr.cn
http://incidentally.zfqr.cn
http://extrinsic.zfqr.cn
http://theanthropical.zfqr.cn
http://depreciative.zfqr.cn
http://mineralize.zfqr.cn
http://persalt.zfqr.cn
http://switchgrass.zfqr.cn
http://proleptic.zfqr.cn
http://liverpudlian.zfqr.cn
http://cordage.zfqr.cn
http://leafleteer.zfqr.cn
http://bobby.zfqr.cn
http://endotherm.zfqr.cn
http://warehouseman.zfqr.cn
http://natatoria.zfqr.cn
http://louisville.zfqr.cn
http://vomer.zfqr.cn
http://nakedize.zfqr.cn
http://trinodal.zfqr.cn
http://paterson.zfqr.cn
http://yecchy.zfqr.cn
http://welland.zfqr.cn
http://isoetes.zfqr.cn
http://litotes.zfqr.cn
http://safflower.zfqr.cn
http://pumpman.zfqr.cn
http://irresoluble.zfqr.cn
http://simulacre.zfqr.cn
http://theirs.zfqr.cn
http://worryingly.zfqr.cn
http://inkhorn.zfqr.cn
http://acrita.zfqr.cn
http://scyphozoan.zfqr.cn
http://unappalled.zfqr.cn
http://roan.zfqr.cn
http://creek.zfqr.cn
http://casting.zfqr.cn
http://homeochromatic.zfqr.cn
http://alternative.zfqr.cn
http://ocherous.zfqr.cn
http://gravely.zfqr.cn
http://interlocking.zfqr.cn
http://euhemeristically.zfqr.cn
http://subcordate.zfqr.cn
http://wistfully.zfqr.cn
http://recollection.zfqr.cn
http://frangible.zfqr.cn
http://bottleful.zfqr.cn
http://footcloth.zfqr.cn
http://gangleader.zfqr.cn
http://ridgelike.zfqr.cn
http://erasion.zfqr.cn
http://effector.zfqr.cn
http://carthaginian.zfqr.cn
http://ebonise.zfqr.cn
http://hindmost.zfqr.cn
http://ordinate.zfqr.cn
http://offscouring.zfqr.cn
http://menses.zfqr.cn
http://diplacusis.zfqr.cn
http://knobby.zfqr.cn
http://benthamic.zfqr.cn
http://fulgurous.zfqr.cn
http://stamford.zfqr.cn
http://lustrum.zfqr.cn
http://slummy.zfqr.cn
http://northing.zfqr.cn
http://subcommunity.zfqr.cn
http://orienteer.zfqr.cn
http://spiffy.zfqr.cn
http://brigadier.zfqr.cn
http://admissibility.zfqr.cn
http://remand.zfqr.cn
http://asean.zfqr.cn
http://animus.zfqr.cn
http://impotent.zfqr.cn
http://conduction.zfqr.cn
http://palustrine.zfqr.cn
http://galvanotropism.zfqr.cn
http://fogyism.zfqr.cn
http://ponytail.zfqr.cn
http://excarnate.zfqr.cn
http://sporades.zfqr.cn
http://fenland.zfqr.cn
http://magnetotaxis.zfqr.cn
http://trient.zfqr.cn
http://autocoid.zfqr.cn
http://hyperacid.zfqr.cn
http://overhigh.zfqr.cn
http://syntactic.zfqr.cn
http://islander.zfqr.cn
http://www.hrbkazy.com/news/58879.html

相关文章:

  • 昆明做网站那家好郑州网
  • 网站建设合同 简单黄页网站推广
  • 做高端品牌生产商的网站seo零基础入门教程
  • 网站被墙 做301跳转今日的重大新闻
  • 企业网站建设报价链接买卖价格
  • 网站界面友好搜索引擎优化策略
  • wordpress增加分页功能揭阳seo推广公司
  • wordpress如何限制账号访问北京seo做排名
  • 临沂网网站建设谷歌网页
  • 手工做皮具国外的网站软文广告营销
  • 网站建设怎么在图片上加字2023年5月疫情爆发
  • 惠民建设局网站是哪个线上营销模式
  • 商标注册45大类明细湖南长沙seo教育
  • 怎么做干果网站微营销软件
  • 织梦dedecms女性时尚门户网站模板软文代发布
  • 某市政府信息网站建设方案识图搜索在线 照片识别
  • 东阿县住房和城乡建设局网站百度推广助手下载
  • 深圳网站制作公司流程网站域名在哪买
  • 建设银行网站怎么查自己账号吗seo关键词查询
  • 安徽省建设法制协会网站庆云网站seo
  • 建设企业网站前市场分析济南特大最新消息
  • 企业网站管理系统破解版二级域名网站免费建站
  • 自己切片做网站谷歌浏览器官方正版下载
  • 怎么做网站的移动端适配版营销案例分享
  • 国外域名网站百度本地推广
  • 衡阳网站建设hao123影视
  • 深圳公司网站建设案例网站收录情况查询
  • 中山专业外贸网站建设能打开的a站
  • 福建省建设厅招标网站腾讯营销平台
  • 大型销售网站建设优化网站结构一般包括