Closed piotrwitek closed 6 years ago
I was reflecting for a while on a new API and I decided to use this (it's almost ready to deploy on the next branch):
// docs example
const deprecatedApi = createActionDeprecated('GET_TODO',
(token: string, id: string) => ({
type: 'GET_TODO',
payload: id,
meta: token,
})
);
const getTodoSimple = (token: string, id: string) => action('GET_TODO', id, token);
const getTodoVariadic = createAction('GET_TODO', actionCallback => {
return (id: string, token: string) => actionCallback(id, token);
});
const getTodoPayload = createStandardAction('GET_TODO')<{ id: string, token: string }>();
const getTodoPayloadMap = createStandardAction('GET_TODO').map(
({ token, id }: { token: string; id: string }) => ({
payload: id,
meta: token,
})
);
const getTodoAsync = createAsyncAction(
'GET_TODO_REQUEST',
'GET_TODO_SUCCESS',
'GET_TODO_FAILURE'
)<{ token: string; id: string }, Todo, Error>();
Get ready folks, official release tomorrow!
Update the "tutorial" section in Readme to provide examples with new API.