This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
React 实例接口 用于接收扩展的 React 实例
interface ISYS_ReactComponentizationDialogReactInstance 此接口定义了从扩展传递的 React 实例的方法。 由于扩展和 pro-api 使用不同的 React 实例,需要通过此接口传递 React 方法。
const ReactInstance = {
createContext: React.createContext,
useContext: React.useContext,
useRef: React.useRef,
useEffect: React.useEffect,
createElement: React.createElement,
};|
Property |
Modifiers |
Type |
Description |
|---|---|---|---|
|
<T>(defaultValue: T) => React.Context<T> |
(ALPHA) 创建 React Context | ||
|
<P extends Record<string, unknown>>(type: React.ElementType<P>, props?: P | null, ...children: React.ReactNode[]) => React.ReactElement<P> |
(ALPHA) 创建并返回指定类型的新 React 元素 | ||
|
<T>(context: React.Context<T>) => T |
(ALPHA) 读取和订阅 Context 的值 | ||
|
(effect: () => undefined | (() => undefined), deps?: React.DependencyList) => void |
(ALPHA) 执行副作用操作 | ||
|
<T>(initialValue: T) => React.MutableRefObject<T> |
(ALPHA) 创建一个可变的 ref 对象 |
This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
创建 React Context
createContext: <T>(defaultValue: T) => React.Context<T>;This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
创建并返回指定类型的新 React 元素
createElement: <P extends Record<string, unknown>>(type: React.ElementType<P>, props?: P | null, ...children: React.ReactNode[]) => React.ReactElement<P>;This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
读取和订阅 Context 的值
useContext: <T>(context: React.Context<T>) => T;This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
执行副作用操作
useEffect: (effect: () => undefined | (() => undefined), deps?: React.DependencyList) => void;This API is provided as an alpha preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.
创建一个可变的 ref 对象
useRef: <T>(initialValue: T) => React.MutableRefObject<T>;