use-channel
create connection between components to share internal states
Este hook implementa @atomico/channel una alternativa a React.Context, pero basada en eventos y agnóstica.

Modulo

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

Syntax

1
const channel = "MyChannel";
2
const [parentValue, setChildValue] = useChannel(channel);
Copied!
Where :
  1. 1.
    channel: String, defines the name of the event to be used to generate the channel.
  2. 2.
    parentValue: Value inherited by the parent component.
  3. 3.
    setChildValue: Callback, defines a value for nested components.

Example

WebComponents.dev
WebComponents.dev
This hook is used by @atomico/components/router
Last modified 2mo ago
Copy link
Edit on GitHub