跳到主要内容

React DOM shared internal fiber

作用​

导出的常量​

内部结构​

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

常量​

默认调度器​

备注
  • noop 由 noop 实现
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,
};

类型​

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),
};