I set up an example here in this example, I would expect that "I am thing: " is kept in sync with "count: ".
Given a connected component:
@connect((state, props) => ({ thing: state.things[props.id] }))
class Thing extends Component {
render() {
return <div children={"I am thing: " + this.props.thing} />;
}
}
I would expect that you could update <Thing /> by passing in a new props.id - however the connected component is set up to only update the internal state when there is a change in the unistore - store instance: https://github.com/developit/unistore/blob/master/src/integrations/preact.js#L37.
Is it considered poor design to use connect to fetch state based on passed props?
Here is a proposed solution: master...lwakefield:master
I set up an example here in this example, I would expect that "I am thing: " is kept in sync with "count: ".
Given a connected component:
I would expect that you could update
<Thing />by passing in a newprops.id- however the connected component is set up to only update the internal state when there is a change in the unistore - store instance: https://github.com/developit/unistore/blob/master/src/integrations/preact.js#L37.Is it considered poor design to use connect to fetch state based on passed props?
Here is a proposed solution: master...lwakefield:master