developit/unistore

What's this mysterious prototype override in the CodeSandbox example? Provider.prototype.render

Birch-san opened this issue · 2 comments

Regarding the example: README Example on CodeSandbox

What's with this mysterious bit:

Provider.prototype.render = function(props) {
  return props.children;
};

If I remove that prototype override: the children don't get rendered.
This seems important enough that it should be in the README.md, or even set as the default behaviour.

Here's my app (unistore 3.2.1, preact 10.0.0-alpha.2), which plays around with store (and updating store from outside of component):

https://codesandbox.io/s/r4l9lv8k5n?fontsize=14

Ah - apologies, I accidentally overwrote the canonical sandbox instead of forking.

I've removed the workarounds, since Preact 10.0.0-alpha.2 fixes both issues.

In your app, update to the latest version of unistore (3.4.1) and you won't need the children override.