How to use MobX in create-react-app with decorators without ejecting.
Clone or download
Latest commit acd383a Feb 9, 2018

MobX Without Ejecting

You can view the full video explanation here:

Packages we'll be installing:

  • react-app-rewired
  • react-app-rewire-mobx
  • babel-plugin-styled-components

In config-overrides.js:

const { injectBabelPlugin } = require("react-app-rewired");
const rewireMobX = require("react-app-rewire-mobx");

module.exports = function override(config, env) {
  config = injectBabelPlugin("babel-plugin-styled-components", config);
  config = rewireMobX(config, env);

  return config;

In package.json modify the scripts to be:

"scripts": {
  "start": "react-app-rewired start",
  "build": "react-app-rewired build",
  "test": "react-app-rewired test --env=jsdom",
  "eject": "react-app-rewired eject"