Skip to content

Instantly share code, notes, and snippets.

View danielbischoff's full-sized avatar

Daniel Bischoff danielbischoff

View GitHub Profile
'use strict';
const fs = require('fs');
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const webpack = require('webpack');
const config = {
mode: 'development',
entry: [
'webpack/hot/dev-server',
class MyStore {
@observable.ref deviceStatus; // Device status is sth. like { isConnected, etc. }
@action
updateStatus = (deviceStatus) => {
this.deviceStatus = deviceStatus;
}
};
const store = new MyStore();
const hiddenSymbol = Symbol();
const obj = { a: 1 };
obj[hiddenSymbol] = 'hidden';
// print all keys
const keys = Object.keys(obj);
console.log(keys); // prints ['a']
// print value of prop hiddenSymbol
console.log(obj[hiddenSymbol]); // prints 'hidden'
class TodoApi {
fetchTodos = () => request.get('/todos')
}
class TodoStore {
@observable todos = [];
constructor(todoApi) {
const searchStore = new SearchStore();
const app = (
<Provider searchStore={searchStore}>
<SearchInput />
</Provider>
);
ReactDom.render(app, container);
class SearchStore {
@observable searchText;
@action
setSearchText = (searchText) => {
this.searchText = searchText
}
}
@observer