All pages
Powered by GitBook
1 of 1

Loading...

use-channel

create connection between components to share internal states

Now, Atomico includes a context API as part of its core. We recommend implementing it as an alternative to using useChannel.

useContext

An alternative to React's context but solely based on hooks.

Modulo

import { useChannel } from "@atomico/hooks/use-channel";

Syntax

Where :

  1. channel: String, defines the name of the event to be used to generate the channel.

  2. parentValue: Value inherited by the parent component.

  3. setChildValue: Callback

Example

This hook is used by

, defines a value for nested components.
const channel = "MyChannel";
const [parentValue, setChildValue] = useChannel(channel);
@atomico/components/router
WebComponents.devWebComponents.dev
Logo