lucid-ui
Version:
A UI component library from AppNexus.
15 lines (14 loc) • 345 B
JavaScript
import _ from 'lodash';
export function onSelect(state = {}, index) {
return {
...state,
selectedIndices: [index],
};
}
export function onToggle(state = {}, index) {
const expandedIndices = state.expandedIndices || [];
return {
...state,
expandedIndices: _.xor(expandedIndices, [index]),
};
}