Rate this page:
This page describes a Forge preview feature. Preview features are deemed stable; however, they remain under active development and may be subject to shorter deprecation windows. Preview features are suitable for early adopters in production environments.
We release preview features so partners and developers can study, test, and integrate them prior to General Availability (GA). For more information, see Forge release phases: EAP, Preview, and GA.
UI kit 2 runs the app in a React runtime which enables you to use some React features.
Type | Format | Description |
---|---|---|
Hooks | import React, { useState, useEffect } from 'react'; | Hooks that previously were imported from @forge/ui such as useState and useEffect should now come from React. |
Context | Built in support as used in React. | React context providers can be included in your app Context-React. |
JSX support | See React documentation for more information. | Syntax extension to JavaScript. |
To import hooks to your app:
import React, { <hook name>} from 'react';
You should be able to use any React hooks that do not rely on an underlying DOM node or depend on any synchronous operations in the browser’s event loop. Hooks are now imported from react
.
useState
useEffect
useContext
useReducer
useCallback
useMemo
useRef
useDebugValue
useDeferredValue
useId
For more information on Hooks, see the Hooks API Reference official page.
Forge UI Kit 2 allows you to use the React context in your apps. For more information, see Context - React documentation.
Components | JSX support | |
---|---|---|
Components imported from @forge/react | ||
Function components composed of @forge/react components | ||
Higher-Order Components – React | ||
Context providers | ||
HTML |
You won’t have access to any of the underlying DOM, so features that depend on that will not work. This includes portals and forwarding refs. You also still cannot use arbitrary HTML, and are restricted to using the components exported from @forge/react
.
Rate this page: