Skip to content

Instantly share code, notes, and snippets.

<script>
import client from "./sanityClient.js";
import groq from "groq";
import {parse, evaluate} from 'groq-js'
import { onMount } from "svelte";
const query = groq`
*[_type == "cms"]{
name,
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
import { EventEmitter } from 'events'
import dispatcher from '../dispatcher'
import axios from 'axios'
import uuid from 'uuid4'
class TodoStore extends EventEmitter {
constructor() {
super()
this.state = {
{
"todos": [
{
"complete": "false",
"edit": "false",
"id": "uuid()",
"text": "Go Shopping"
},
{
"complete": "false",
import { EventEmitter } from 'events'
import dispatcher from '../dispatcher'
import axios from 'axios'
import uuid from 'uuid4'
class TodoStore extends EventEmitter {
constructor() {
super()
this.state = {
import dispatcher from "../dispatcher";
export function addTodo(text) {
dispatcher.dispatch({
type: "ADD_TODO",
text,
});
}
export function deleteTodo(todoToDelete) {
import React from 'react'
// Flux
import * as TodoActions from '../../actions/TodoActions'
export default class Todo extends React.Component {
constructor(props) {
super(props)
this.handleDeleteTodo = this.handleDeleteTodo.bind(this)
this.handleCompleteToggle = this.handleCompleteToggle.bind(this)