Skip to content

Instantly share code, notes, and snippets.

View alexmochu's full-sized avatar
🤙
Good Vibes Only!

Karanja Mochu alexmochu

🤙
Good Vibes Only!
View GitHub Profile
@alexmochu
alexmochu / reducers.js
Created June 30, 2020 11:19
Create Reducer
import { combineReducers } from 'redux';
const initialState = 0;
function count(state = initialState, action) {
switch (action.type) {
case 'INCREMENT':
return state + 1
case 'DECREMENT':
return state - 1
@alexmochu
alexmochu / store.js
Created June 30, 2020 11:15
Create Redux Store
import { applyMiddleware, createStore } from 'redux';
import createSagaMiddleware from 'redux-saga';
import { composeWithDevTools } from 'redux-devtools-extension';
import rootReducer from './reducers';
import rootSaga from './sagas';
export default function configureStore(initialState) {
const sagaMiddleware = createSagaMiddleware();
const middlewares = [sagaMiddleware];

For example, to override the AppBar (https://material-ui-next.com/api/app-bar/) root class we can do the following:

First method (override Material UI classnames):

1 - Add the property classes in the AppBar component:

    <AppBar classes={{root: 'my-root-class'}}
@alexmochu
alexmochu / machine.js
Last active January 23, 2020 12:51
Generated by XState Viz: https://xstate.js.org/viz
const machineConfig = {
id: 'signIn',
context: {
email: '',
password: '',
},
initial: 'dataEntry',
states: {
dataEntry: {
on: {