UNPKG

fluorine-lib

Version:

Reactive state and side effect management for React using a single stream of actions

14 lines (12 loc) 412 B
import React, { Component } from 'react' import wrapActions from '../util/wrapActions' export default function withActions(observer, actions, prop = 'actions', wrapRecursively = true) { return Child => class ActionContainer extends Component { render() { return React.createElement(Child, { ...this.props, [prop]: wrapActions(observer, actions, wrapRecursively) }) } } }