Accept caller-supplied content
#children or named ReactNode props accept composed UI.
Fragment
Before you use this
React TypeScript/JSX project; use body fragments in a component and supply app-owned names.
import type { ReactNode } from "react";Reference
Compare native component, state, event and lifecycle syntax in four frameworks.
React function components, Svelte 5 runes, modern SwiftUI (Observation examples require iOS 17+) and Jetpack Compose. Snippets are independent component/body fragments; import the named framework APIs. Native lifecycle and ownership rules differ.
children or named ReactNode props accept composed UI.
Fragment
Before you use this
React TypeScript/JSX project; use body fragments in a component and supply app-owned names.
import type { ReactNode } from "react";Context shares a value with descendants. The nearest matching provider wins.
Fragment
Before you use this
React TypeScript/JSX project; use body fragments in a component and supply app-owned names. Provider shorthand: React 19+.
import { createContext, useContext } from "react";A ref retains a DOM handle without making ref writes reactive.
Fragment
Before you use this
React TypeScript/JSX project; use body fragments in a component and supply app-owned names.
import { useRef } from "react";