UNPKG

react-reducer-provider

Version:

Asynchronous/Synchronous React Centralized State with Hooks and HOC

17 lines (13 loc) 473 B
// Copyright (c) 2020 Gonzalo Müller Bravo. // Licensed under the MIT License (MIT), see LICENSE.txt import * as React from 'react' import { imbueStateProvider, nextState, setContextValue } from './imbueStateProvider' export class AsyncMapperProvider extends React.Component { constructor(props) { super(props) imbueStateProvider(this, props) } async wd(...args) { return setContextValue(this, await nextState(this, this.props.mapper, ...args)) } }