Create-react-app: Using Mobx

Created on 15 Oct 2018  Â·  6Comments  Â·  Source: facebook/create-react-app

Hi Team,

Want to use mobx, can i use with create-react-app

I dont want to eject the application.

Regards
Rituj

stale

Most helpful comment

You can also use https://github.com/sharegate/craco. From what I see in your article you would be able to customize the CRA config with the following craco.config.file

module.exports = {
    babel: {
         plugins: [
             "babel-plugin-transform-decorators-legacy"
         ]
    }
};

EDIT

The plugin has been updated with babel 7, I added a new recipe in the repositories for MobX:

https://github.com/sharegate/craco/tree/master/recipes/use-mobx

All 6 comments

You mean you want to use decorators? Mobx works also without decorators.
Otherwise try customize-cra package from Adam Rackis which allows some
webpack tweaking. It's forked from CRA2.

V pon., 15. okt. 2018 11:47 je oseba Rituj Kumar notifications@github.com
napisala:

Hi Team,

Want to use mobx, can i use with create-react-app

I dont want to eject the application.

Regards
Rituj

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/facebook/create-react-app/issues/5438, or mute the
thread
https://github.com/notifications/unsubscribe-auth/AKV7ekX1FJpNcOwele80_5Bl16eHyeTlks5ulFmWgaJpZM4Xb92D
.

So how can i use it.

  1. I am not using decorators then

    • Just i need to install the mobx dependency

      like : yarn add mobx mobx-react;

      Or do i need . to do some different settings ??

If i am ejecting i know how to do that.
reff Link : https://www.leighhalliday.com/create-react-app-mobx-decorators

you can use react-app-rewired and react-app-rewire-mobx

You can also use https://github.com/sharegate/craco. From what I see in your article you would be able to customize the CRA config with the following craco.config.file

module.exports = {
    babel: {
         plugins: [
             "babel-plugin-transform-decorators-legacy"
         ]
    }
};

EDIT

The plugin has been updated with babel 7, I added a new recipe in the repositories for MobX:

https://github.com/sharegate/craco/tree/master/recipes/use-mobx

This issue has been automatically marked as stale because it has not had any recent activity. It will be closed in 5 days if no further activity occurs.

This issue has been automatically closed because it has not had any recent activity. If you have a question or comment, please open a new issue.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

gaearon picture gaearon  Â·  152Comments

sgriffey picture sgriffey  Â·  113Comments

akctba picture akctba  Â·  80Comments

ericdfields picture ericdfields  Â·  78Comments

gaearon picture gaearon  Â·  85Comments