React - Can you update an Unstated container state from an external function?
问题 In the example from the Unstated library they update state within a container by interacting with a jsx button that is subscribed to the container. import React from 'react'; import { render } from 'react-dom'; import { Provider, Subscribe, Container } from 'unstated'; type CounterState = { count: number }; class CounterContainer extends Container<CounterState> { state = { count: 0 }; increment() { this.setState({ count: this.state.count + 1 }); } decrement() { this.setState({ count: this