import { useGate } from "effector-react";

Methods

useGate(Gate, props?)

Hook for passing data to Gate.

Formulae

const CustomGate: Gate<T>;

useGate(CustomGate, props?: T): void;

Arguments

  1. Gate (Gate<T>)
  2. props (T)

Returns

(void)

Examples

Basic

import { createGate, useGate } from "effector-react";
import { Route } from "react-router";

const PageGate = createGate("page");

PageGate.state.watch(({ match }) => {
  console.log(match);
});

const Home = (props) => {
  useGate(PageGate, props);

  return <section>Home</section>;
};

const App = () => <Route component={Home} />;
Contributors