Intro Quote
BuilderX
import Perf from 'react-addons-perf'; // ES6
var Perf = require('react-addons-perf'); // ES5 with npm
For when you need high performance out of your app, use React's shouldComponentUpdate() to add optimization hints.
import { createStore } from "redux";
import { onSnapshot } from "mobx-state-tree";
export default class ReduxDevTools {
static logger(state = {}, action: { state: any; type: string }) {
return action.state;
}
static init(state: any) {
const store: any = createStore(
ReduxDevTools.logger,
(window as any).__REDUX_DEVTOOLS_EXTENSION__ &&
(window as any).__REDUX_DEVTOOLS_EXTENSION__()
);
onSnapshot(state, snapshot => {
store.dispatch({ type: "LOG", state: snapshot });
});
}
}
Measure time take for various actions using console.time.
Update root MST store in window on every snapshot so that we can view the state tree from Chrome console.
Created a HOC which gets the list of observables for the input components and finds their path in root MST store.
Used MobX spy.
We realized that our render() was taking too long.
We were doing two things at once
Redux
Mobx
Redux
mobx-state-tree
Our own state management solution
Snapshot generation is an overhead
credits: Brendan Eich