This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export function getObjectives() { | |
return dispatch => { | |
dispatch(isLoading()); | |
axios | |
.get('url') | |
.then(res => { | |
dispatch(setObjectives(res.data)) | |
dispatch(isNotLoading()); | |
}) | |
.catch(err => { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useState, useRef, useEffect } from 'react'; | |
import { findDOMNode } from 'react-dom'; | |
import List from '@material-ui/core/List'; | |
import ListItem from '@material-ui/core/ListItem'; | |
import ListItemText from '@material-ui/core/ListItemText'; | |
import Radio from '@material-ui/core/Radio'; | |
import clsx from 'clsx'; | |
import { useStore, useActions } from 'easy-peasy'; | |
import { EditableText } from 'shared'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import { findDOMNode } from 'react-dom'; | |
import List from '@material-ui/core/List'; | |
import ListItem from '@material-ui/core/ListItem'; | |
import ListItemText from '@material-ui/core/ListItemText'; | |
import Radio from '@material-ui/core/Radio'; | |
import clsx from 'clsx'; | |
import { pipe, makeHandlers, makeEffect, makeState, makeRef } from 'arranger'; | |
import { EditableText } from 'shared'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { action, createStore, StoreProvider, useStore, useActions } from 'easy-peasy'; | |
// 👇 create your store, providing the model | |
const store = createStore({ | |
todos: { | |
items: ['Install easy-peasy', 'Define your model', 'Have fun'], | |
// 👇 define actions directly on your model | |
add: action((state, payload) => { | |
// simply mutate state to update, and we convert to immutable updates | |
state.items.push(payload) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { createStore } from 'easy-peasy'; | |
import loadingMiddleware from './loadingMiddleware'; | |
import notifier from './notifier'; | |
import indicators from './indicators'; | |
import session from './session'; | |
import tables from './tables'; | |
import dashboard from './dashboard'; | |
import date from './date'; | |
import calendar from './calendar'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react' | |
import { render } from 'react-dom' | |
import { Provider } from 'react-redux' | |
import { createStore } from 'redux' | |
import rootReducer from './reducers' | |
import App from './components/App' | |
const store = createStore(rootReducer) | |
render( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { StoreProvider, createStore } from 'easy-peasy'; | |
import model from './model'; | |
import App from './App'; | |
const store = createStore(model); | |
function Root() { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { action } from "easy-peasy"; | |
let id = 0; | |
export default { | |
todos: {}, | |
// actions | |
add: action((state, text) => { | |
const todo = { | |
id: id++, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Todos() { | |
const todos = useStore(state => state.todos); | |
const { toggle, del } = useActions(actions => ({ | |
toggle: actions.toggle, | |
del: actions.delete, | |
})); | |
const todosList = Object.values(todos); | |
return todosList.map(todo => ( | |
<Todo key={todo.id} todo={todo} toggle={toggle} del={del} /> | |
)); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { useEffect, useState } from 'react'; | |
import { useActions, useStore } from 'easy-peasy'; | |
export default function App() { | |
return ( | |
<div> | |
<h1 style={{ margin: 0 }}>Todo</h1> | |
<Todos /> | |
<AddTodo /> | |
</div> |
OlderNewer