mobx-preact icon indicating copy to clipboard operation
mobx-preact copied to clipboard

Deprecate this package?

Open capaj opened this issue 6 years ago • 9 comments

It would be nice to add a depreciation notice once preact X gets released as it should be possible to just use mobx-react. Or am I wrong to assume that it is not needed anymore?

capaj avatar Apr 20 '19 09:04 capaj

When it does get released and the value of this project is no more; then lets look at it

philmander avatar Sep 23 '19 11:09 philmander

In April I assumed it would be released much much sooner.

capaj avatar Sep 23 '19 12:09 capaj

I don't really follow development of Preact, but how much is this true?

https://github.com/marvinhagemeister/preact-faq/blob/master/migrate-to-x.md#mobx-preact

If it is correct, was there some actual testing to confirm the compatibility? It should be mentioned in the README here in that case. I do maintain mobx-react-lite and mobx-react and I certainly don't like that you are sending people in our direction without the previous discussion. If someone can confirm 100% compatibility, we can surely add a note to docs as well for mobx-react, but so far it feels like "fingers crossed, it works".

I've skimmed through the readme here and we don't support componentWillReact anymore and also no connect utility is present. That really doesn't feel like full compatibility. You should offer some migration path in here in that case.

danielkcz avatar Oct 22 '19 17:10 danielkcz

Preact X has been out some time now... and with the release of MobX 6, I am wondering if we will see a new version of mobx-preact here? Or should Preact users be looking instead to mobx-react-lite and mobx-react for their needs?

korgon avatar Oct 14 '20 19:10 korgon

Would be nice if someone can actually confirm it works with mobx-react. I don't care about Preact enough to give it a try :)

danielkcz avatar Oct 14 '20 19:10 danielkcz

I am using it now - and it works... for the most part.

preact: 10.4.8 mobx: 6.0.1 mobx-react: 7.0.0

I have only noticed one issue so far - and that is the render function is not being passed the props or state arguments (class components).

From the Preact site (https://preactjs.com/guide/v10/differences-to-react):

Arguments in Component.render() For convenience we pass this.props and this.state of a class component to the render().

Would this difference justify the existence of a separate package for Preact (mobx-preact)? I'll keep working with it and see if I encounter any other issues/discrepancies.

korgon avatar Oct 15 '20 15:10 korgon

There is a big chance I'm doing something wrong, but currently it looks like mobx-react is using react-dom. So it won't work as an alternative for dedicated package for mobx integration.

The error:

@parcel/core: Failed to resolve 'react-dom' from './node\\_modules/mobx-react-lite/dist/mobxreactlite.cjs.development.js'
...\node_modules\mobx-react-lite\dist\mobxreactlite.cjs.development.js:10:24
   9 | var React__default = _interopDefault(React);
> 10 | var reactDom = require('react-dom');

Versions:

    "preact": "^10.5.14",
    "mobx": "^6.3.2",
    "mobx-react": "^7.2.0",

ghost avatar Aug 23 '21 21:08 ghost

@dcbrwn Maybe you just need to setup some aliases for your bundler? https://preactjs.com/guide/v8/switching-to-preact/#aliasing-via-parcel

korgon avatar Aug 24 '21 03:08 korgon

Well aliases are unpredictable, unstable borderline hack, so the mobx adapter for preact still deserves a dedicated package IMO.

ghost avatar Aug 24 '21 22:08 ghost