Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

React components compose by passing props—including JSX—to child components. Nest content to create a children slot; lift state when components must coordinate one value; use context when information needs to reach distant descendants; and use custom Hooks to reuse stateful logic. These patterns solve different problems, so choose based on what is being shared and who needs it.

Compose components with props and JSX

Props are the ordinary, explicit way for a parent to pass information to a child. They can hold strings, objects, callbacks, and JSX. A component that receives JSX can render it without needing to know how that content is built.

Use children for nested content

When JSX is nested between a component’s opening and closing tags, React makes that content available through the children prop. This is a natural fit for wrappers such as cards, panels, and layouts:

function Panel({ children }) {
  return <section className="panel">{children}</section>;
}

function Profile() {
  return (
    <Panel>
      <h2>Account</h2>
      <p>Manage your profile settings.</p>
    </Panel>
  );
}

Panel controls the surrounding structure while its caller supplies the content. React documents nested JSX as the children prop, and describes children as a React node supplied by JSX nesting in its common components reference.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Elebase USB to USB C Adapter for iPhone 18 Pro Max,USBC Car Charger Adapter
  • Read Before You Buy — No Video Output: These adapters support charging and USB 2.0 data transfer, but cannot transmit video signals. Except for standard USB webcams (which use USB data only), they are not compatible with HDMI/DisplayPort cables, video-capable USB-C hubs, or docking stations with video output.
  • Convert USB-A Ports to USB-C: Designed to connect USB-C earphones, cables, flash drives, card readers, and other USB-C accessories to standard USB-A ports. Plug-and-play with no drivers or software required.
  • Aluminum Alloy Housing: Built with a sturdy aluminum alloy shell that aids in heat dissipation and protects against daily wear and scratches. Designed to maintain a stable and secure connection.
  • Compact & Travel-Friendly: The ultra-compact design allows the adapter to stay plugged into your device without blocking adjacent ports or adding bulk, reducing wear and tear on your original USB ports.
  • 12-Month Warranty: Backed by a 12-month manufacturer warranty for peace of mind. Designed to meet strict quality control standards for reliable everyday performance.

Use a named JSX prop for a clear slot

Not all inserted content needs to be called children. A named prop can clarify the role of a particular slot, especially when a component accepts several distinct pieces of JSX:

function Dialog({ title, actions }) {
  return (
    <section role="dialog">
      <h2>{title}</h2>
      {actions}
    </section>
  );
}

<Dialog
  title="Delete project?"
  actions={<button>Cancel</button>}
/>

Choose the prop name that describes the content’s purpose. In both forms, the receiving component owns the frame and the calling component supplies the inserted JSX.

Keep data flow explicit and props immutable

A parent can decide what a child receives by passing values as props. React treats props as read-only snapshots for a render: a component should not mutate them. When data needs to change, update the state that owns it and render again with new props.

Rank #2
Anker USB-C Hub, 5-in-1 USB Hub for Laptops, 4K HDMI Multiport Adapter
  • 5-in-1 USB-C Hub: Experience comprehensive connectivity featuring a Power Delivery input, two USB-A 2.0 ports, a USB-A 3.0 port, and an HDMI port. (Note: The USB-C power delivery input port is only for connecting an external wall charger to power your laptop and cannot power peripheral devices.)
  • 90W Pass-Through Charging: Achieve optimal charging with 90W pass-through power to your laptop, supported by a total input of 100W, with the hub reserving 10W for operational efficiency. (Note: Wall charger not included.)
  • Quick Data Transfers: Accelerate your productivity with rapid data transfers using a high-speed 5Gbps USB 3.0 port and two 480Mbps USB 2.0 ports.
  • 4K HDMI Display: Enhance your visual experience with a hub capable of delivering 4K resolution at 30Hz in both mirror and extend modes. Please note that this hub is compatible with MacBook (macOS 12 and newer), Windows 10 and 11, ChromeOS, and laptops equipped with DP Alt Mode and Power Delivery. Note: This device is not compatible with Linux.
  • What You Get: Anker USB-C Hub (5-in-1, 4K HDMI), welcome guide, 18-month warranty, and our friendly customer service.

Explicit props make dependencies visible in the component’s API. Avoid forwarding a broad set of props automatically through several layers when those components do not need them; repeated forwarding can obscure which component uses which information. If the middle components only arrange the UI, passing JSX as children may let the content travel around them without threading unrelated values through each one.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Share one coordinated state value by lifting it

If two or more components need to stay in sync around the same value, store that value in their closest common parent. The parent passes the current value down as props and gives children handlers they can call to request a change. React calls this lifting state up.

Example: coordinate accordion panels

For an accordion that allows only one panel to be open at a time, the accordion parent can own the open panel’s identifier. Each panel receives whether it is open and a handler for selecting it:

Rank #3
Sale
Anker USB C Hub, 7in1 Multi-Port USB Adapter, 4K@60Hz USBC to HDMI Splitter
  • Sleek 7-in-1 USB-C Hub: Features an HDMI port, two USB-A 3.0 ports, and a USB-C data port, each providing 5Gbps transfer speeds. It also includes a USB-C PD input port for charging up to 100W and dual SD and TF card slots, all in a compact design.
  • Flawless 4K@60Hz Video with HDMI: Delivers exceptional clarity and smoothness with its 4K@60Hz HDMI port, making it ideal for high-definition presentations and entertainment. (Note: Only the HDMI port supports video projection; the USB-C port is for data transfer only.)
  • Double Up on Efficiency: The two USB-A 3.0 ports and a USB-C port support a fast 5Gbps data rate, significantly boosting your transfer speeds and improving productivity.
  • Fast and Reliable 85W Charging: Offers high-capacity, speedy charging for laptops up to 85W, so you spend less time tethered to an outlet and more time being productive.
  • What You Get: Anker USB-C Hub (7-in-1), welcome guide, 18-month warranty, and our friendly customer service.
function Accordion() {
  const [activeIndex, setActiveIndex] = useState(0);

  return (
    <>
      <Panel
        isActive={activeIndex === 0}
        onShow={() => setActiveIndex(0)}
      />
      <Panel
        isActive={activeIndex === 1}
        onShow={() => setActiveIndex(1)}
      />
    </>
  );
}

The exact state shape depends on the interface; the key is that there is one owner for the value that must stay coordinated. React’s state-sharing guide recommends placing coordinated state in the closest common parent and passing it to the components that need it.

Controlled and uncontrolled describe ownership

A component is controlled when its parent supplies the value that determines its behavior, such as an isActive prop. It is uncontrolled when it keeps that value internally. Neither is automatically better: use parent ownership when other components must coordinate with the value; internal ownership can be simpler when the value is private to that component.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Use context when information needs to travel deeply

Context lets a component make information available to descendants without passing it through every intermediate component as a prop. That can help when many components or distant descendants need the same information. React’s documentation lists theming, the current account, routing, and state management among common context uses.

Rank #4
Sale
UGREEN USB to USB C Adapter Combo 4-Pack, 10Gbps USB C Converter Space Gray
  • Dual Converters, Infinite Potential:Includes 2× USB C male to USB A female adapters and 2× USB A male to USB C female adapters. Perfect for a wide range of uses—tablets with Bluetooth keyboards, expand USB ports on macbook, and more. Two different converters for all your daily needs
  • Next-Level 10Gbps & 3A Charging: No more slow 480Mbps, this usb to usb c adapter has a transfer speed of up to 10Gbps, allowing you to do more transferring in less time. This usb adapter fits both USB A and USB C charger, supporting up to 3A fast charging
  • Upgraded Exquisite Craftsmanship: With an aluminum alloy housing and metal connector, the usbc to usb adapter is extremely durable and sturdy. Rigorously tested to withstand more than 10,000 times of plugging and unplugging, ensuring long-lasting performance
  • Broad Compatible: The usb c to usb adapter widely supports all USB C/ USB A devices like laptops, tablets, cellphones, car chargers, and phone chargers. Such as compatible with MacBook Pro/Air 2023/2022, Thunderbolt 4/3 Devices,Apple MagSafe Watch 9/8/7/SE/Ultra, iPad Pro 2022/2021, Samsung Galaxy S23/S20/S10, and iPhone 17/16/15 Pro. Plug and play
  • Please Note: To reach 10Gbps speed, keep the cable under 3.3 ft. For USB A Male to USB C adapters, try flipping the USB C connector. USB C Male to USB A adapters support bidirectional 10Gbps transfer within 3.3 ft

First check whether ordinary props already keep the data flow clear. Also consider extracting a component so an intermediate layout can receive the relevant UI as children rather than accepting and forwarding data it does not use. React’s context guide recommends considering these alternatives because context can be overused.

The trade-off is API visibility: explicit props show what a component consumes, while context avoids repeated passage through intermediate components. Context is most useful when the value genuinely belongs to a broader subtree, not merely because passing a prop once feels inconvenient.

Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Use custom Hooks to reuse logic, not one shared state instance

A custom Hook packages reusable stateful behavior so multiple components can use the same logic. For example, an online-status Hook can encapsulate how a component subscribes to connectivity changes, while a form Hook can collect common input behavior.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Best Value
Anker USB C Hub, 5-in-1 USBC to HDMI Splitter with 4K Display
  • 5-in-1 Connectivity: Equipped with a 4K HDMI port, a 5 Gbps USB-C data port, two 5 Gbps USB-A ports, and a USB C 100W PD-IN port. Note: The USB C 100W PD-IN port supports only charging and does not support data transfer devices such as headphones or speakers.
  • Powerful Pass-Through Charging: Supports up to 85W pass-through charging so you can power up your laptop while you use the hub. Note: Pass-through charging requires a charger (not included). Note: To achieve full power for iPad, we recommend using a 45W wall charger.
  • Transfer Files in Seconds: Move files to and from your laptop at speeds of up to 5 Gbps via the USB-C and USB-A data ports. Note: The USB C 5Gbps Data port does not support video output.
  • HD Display: Connect to the HDMI port to stream or mirror content to an external monitor in resolutions of up to 4K@30Hz. Note: The USB-C ports do not support video output.
  • What You Get: Anker 332 USB-C Hub (5-in-1), welcome guide, our worry-free 18-month warranty, and friendly customer service.

Calling the same custom Hook in two components does not make their state shared. Each Hook call has its own independent state. If those components must display or update one coordinated value, lift that value to a common parent or use context where appropriate. React explains this distinction in Reusing Logic with Custom Hooks.

Preserve React’s render and component rules

Composition stays predictable when render logic is pure: for the same inputs, a component should return the same UI without causing side effects. Do not mutate props or state, and do not perform side effects during render. Put side effects in the appropriate event handlers or Effects instead.

Render components through JSX rather than calling component functions as ordinary functions. React must control component invocation to manage rendering correctly. These principles are set out in React’s Rules of React.

Choose the pattern by what you need to share

Need Pattern Why it fits
Markup or content inside a wrapper children or a named JSX prop The wrapper renders supplied content without owning its details.
One value coordinated across components Lift state to the closest common parent; pass values and handlers as props One component owns the value that must remain in sync.
Information needed by distant descendants or many components Context, after considering props and component extraction Descendants can access the value without intermediate forwarding.
Repeated stateful behavior across components Custom Hook Components reuse logic while each Hook call keeps independent state.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.