Skip to content

Instantly share code, notes, and snippets.

@perjo927
Created September 8, 2020 16:49
Show Gist options
  • Save perjo927/40aaaa0ca9cd152d77ed06c06457b77f to your computer and use it in GitHub Desktop.
Save perjo927/40aaaa0ca9cd152d77ed06c06457b77f to your computer and use it in GitHub Desktop.
Premature Main file
import css from "./main.css";
import { createStore } from "./redux/store/index";
import { actions } from "./redux/actions/index";
import { rootReducer } from "./redux/reducers/index";
import { render } from "lit-html";
import { App } from "./templates/App";
const store = createStore(rootReducer, {});
store.subscribe(() => console.log(store.getState()));
const { id } = store.dispatch(actions.addTodo({id: 1, done: false, text: "My first todo"}));
store.dispatch(actions.toggleTodo(id));
store.dispatch(actions.undo());
store.dispatch(actions.redo());
store.dispatch(actions.setVisibility("IN_PROGRESS"));
export default () => {
// Initial render
render(App({ store, actions }), document.body);
// Subsequent renders
store.subscribe(() => render(App({ store, actions }), document.body));
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment