跳到主要内容

React DOM shared internal fiber

一、作用

二、导出的常量

1. 内部结构

备注
const Internals: ReactDOMInternals = {
Events: null as any,
d /* ReactDOMCurrentDispatcher */: DefaultDispatcher,
p /* currentUpdatePriority */: NoEventPriority,
findDOMNode: null,
};

三、常量

1. 默认调度器

备注
  • noopnoop 实现
const DefaultDispatcher: HostDispatcher = {
// 同步刷新工作
f /* flushSyncWork */: noop,
// 请求表单重置
r /* requestFormReset */: noop,
// 预取DNS
D /* prefetchDNS */: noop,
// 预连接
C /* preconnect */: noop,
// 预加载
L /* preload */: noop,
m /* preloadModule */: noop,
X /* preinitScript */: noop,
S /* preinitStyle */: noop,
M /* preinitModuleScript */: noop,
};

四、类型

1. ReactDOM 内部模块

type ReactDOMInternals = {
Events: [any, any, any, any, any, any],
d /* ReactDOMCurrentDispatcher */: HostDispatcher,
p /* currentUpdatePriority */: EventPriority,
findDOMNode:
| null
| ((componentOrElement: component(...props: any)) => null | Element | Text),
};