Skip to content
This repository has been archived by the owner on May 16, 2024. It is now read-only.

Counter

Dima Vyshniakov edited this page Nov 19, 2022 · 1 revision

Counter

Stores value in the Redux state and increments by 1.

Selectors

useCountValue

Returns count value from the store.

import {useCountValue} from 'features/counter';

// Needs to be run from inside React component or other hook.
const count = useCountValue();

Action creators

useIncrementCounter

Increment stored count value by one.

import {useIncrementCounter} from 'features/counter';

// Needs to be run from inside React component or other hook.
const incrementCounter = useIncrementCounter();
const handleClick = () => {
  incrementCounter();
}