export const getIsLoadedSelector = ({ apps }) =>
customReducer.todoReducer.delete.isLoaded;
export const getIsLoadedSelector2 = ({ apps }) =>
customReducer.todoReducer2.delete.isLoaded;
const checkBox = new Switch({
el: ...,
toggler: 'checkbox__input',
});
const mySwitch = new Switch({
el: ...,
toggler: 'checkbox__switch',
});
.select {}
.loading {}
.item {}
.icon {}
.select {}
.select__item {}
.select__item__icon {}
.select--loading {}
import { combineReducers } from 'redux';
const createAsyncReducer = entityName => (state, action) => {
const { type, payload } = action;
switch (type) {
case entityName + '_REQUEST':
return {
...state,
isFetching: true,
};
case entityName + '_SUCCESS':
return {
...state,
isFetching: false,
data: payload,
error: null,
};
case entityName + '_FAILURE':
return {
...state,
isFetching: false,
error: payload,
};
default: return state;
}
}
const todoReducer = withTodo(createAsyncReducer('TODO'));
const todoReducer2 = createAsyncReducer('TODO2');
export const customReducer = combineReducers({
todoReducer,
todoReducer2,
});
const {
reducer,
saga,
actions,
selectors,
api,
actionTypes,
} = generateCrudBoilerplate(
'products',
{
getList: () => `/api/products`,
getOne: id => `/api/product/${id}`,
add: payload => `/api/product/`,
remove: id => `/api/product/${id}`,
edit: (id, payload) => `/api/product/${id)`,
}
);
const fetchInitialDataApi = () => axios.get('http://swapi.co/api/people/?format=json');
const fetchInitialDataApi = () => fetch('http://swapi.co/api/people/?format=json')
.then(res => res.json());
const { data } = await fetchDataApi();
const data = await fetchDataApi();
if (action.type === 'GET_DATA') {
return { data: API() }
}
getState().some.path.somePath2.somePath3;
ksf.classes.KsfSwitch = ...
const store = createStore({ counter: 0 });
const getState = store.getState;
const setState = store.setState;
const increment = () => {
setState({
type: 'counter',
counter: getState().counter + 1,
});
};
increment();
const store = createStore({ counter2: { value: 0 } });
const getState = store.getState;
const setState = store.setState;
const increment2 = () => {
const { value } = getState().counter2;
setState({
type: 'counter2',
counter2: {
value: value + 1,
},
});
};
increment2();