Last updated May 16, 2023

This section 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.

## React runtime

UI kit 2 runs the app in a React runtime which enables you to use some React features.

TypeFormatDescription
Hooksimport React, { useState, useEffect } from 'react';Hooks that previously were imported from @forge/ui such as useState and useEffect should now come from React.
ContextBuilt in support as used in React.React context providers can be included in your app Context-React.
JSX supportSee React documentation for more information.
Syntax extension to JavaScript.

Hooks

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.

Supported hook types

  • useState

  • useEffect

  • useContext

  • useReducer

  • useCallback

  • useMemo

  • useRef

  • useDebugValue

  • useDeferredValue

  • useId

For more information on Hooks, see the Hooks API Reference official page.

Context

Forge UI Kit 2 allows you to use the React context in your apps. For more information, see Context - React documentation.

JSX support

Limitations

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: