跳到主要内容

React fiber config with no singletons

不支持变异的渲染器可以从此模块重新导出所有内容。

一、作用

不支持变异的渲染器可以从此模块重新导出所有内容。

二、导出的常量

1. 支持单例模式

备注

源码中 21 - 22 行

// Resources (when unsupported)
// 资源(当不支持时)
export const supportsSingletons = false;

2. 解析单例实例

备注

源码中 23 行

export const resolveSingletonInstance = shim;

3. 获取单例实例

备注

源码中 24 行

export const acquireSingletonInstance = shim;

4. 释放单例实例

备注

源码中 25 行

export const releaseSingletonInstance = shim;

5. 判定是否为宿主单例类型

备注

源码中 26 行

export const isHostSingletonType = shim;

6. 判定是否为单例范围

备注

源码中 27 行

export const isSingletonScope = shim;

三、工具

1. 兼容垫片

// Renderers that don't support mutation
// can re-export everything from this module.
// 不支持变异的渲染器可以从此模块重新导出所有内容。

function shim(...args: any): any {
throw new Error(
'The current renderer does not support Singletons. ' +
'This error is likely caused by a bug in React. ' +
'Please file an issue.',
);
}