/
githubmirror
/
redux
Обзор
Документация
Войти
/
githubmirror
/
redux
Код
Запросы
0
Пакеты
0
Релизы
0
Аналитика
Безопасность
master
examples/tree-view/src/actions/index.js
33 строки
633 B
Tim Dorr
Format the examples
20 мар 2024, 19:52
Не верифицирован
20 мар 2024, 19:52
3085048
Код
Авторство
О чём код?
export const INCREMENT = 'INCREMENT' export const CREATE_NODE = 'CREATE_NODE' export const DELETE_NODE = 'DELETE_NODE' export const ADD_CHILD = 'ADD_CHILD' export const REMOVE_CHILD = 'REMOVE_CHILD' export const increment = nodeId => ({ type: INCREMENT, nodeId }) let nextId = 0 export const createNode = () => ({ type: CREATE_NODE, nodeId: `new_${nextId++}` }) export const deleteNode = nodeId => ({ type: DELETE_NODE, nodeId }) export const addChild = (nodeId, childId) => ({ type: ADD_CHILD, nodeId, childId }) export const removeChild = (nodeId, childId) => ({ type: REMOVE_CHILD, nodeId, childId })