SHARE
TWEET

Untitled

a guest Apr 18th, 2019 93 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const TodoApp = () => {
  2.   const [store, {
  3.       addTodo, toggleAll, editTodo,
  4.       removeTodo, clearCompleted, setVisibility
  5.     }] = createTodosStore(),
  6.     locationHandler = () =>
  7.       setVisibility(location.hash.slice(2) || 'all'
  8.     );
  9.  
  10.   window.addEventListener('hashchange', locationHandler);
  11.   onCleanup(() =>
  12.     window.removeEventListener('hashchange', locationHandler)
  13.   );
  14.   return <section class='todoapp'>
  15.     <TodoHeader addTodo={addTodo} />
  16.     <$ when={store.todos.length > 0}>
  17.       <TodoList {...{store, toggleAll, editTodo, removeTodo}}/>
  18.       <TodoFooter store={store} clearCompleted={clearCompleted} />
  19.     </$>
  20.   </section>
  21. }
  22.  
  23. createRoot(() => document.body.insertBefore(
  24.   <TodoApp />,
  25.   document.body.firstChild
  26. ));
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top