Skip to content

Instantly share code, notes, and snippets.

View alissaVrk's full-sized avatar

alissa verkhovsky alissaVrk

View GitHub Profile
@alissaVrk
alissaVrk / TodoProvider.tsx
Last active March 20, 2023 06:12
TodoProvider with a simple reactive store
import React, { PropsWithChildren, useMemo } from 'react';
import { createSimpleReactiveStore } from './simple-reactive-store';
export type Todo = {
id: string;
name: string;
};
export type TodoAPI = {
addTodo: (todo: Todo) => void;
import { SimpleReactiveStore } from './simple-reactive-store';
import React, { useContext, Context, useEffect } from 'react';
type ContextProps<T> = {
context: Context<T>;
path: string;
simpleStore: SimpleReactiveStore;
};
export function ContextListener<T>({ context, path, simpleStore }: ContextProps<T>) {
import { set, unset, get, PropertyPath } from 'lodash';
import { useSyncExternalStore } from 'react';
export type SimpleReactiveStore = ReturnType<typeof createSimpleReactiveStore>;
/**
*
* @returns a simple store you can use with your react components.
*/
export function createSimpleReactiveStore() {
const data: object = {};
@alissaVrk
alissaVrk / jitsu deploy error
Created August 30, 2012 09:56
jitsu deploy error
info: Creating snapshot 0.0.0-11
info: Updating app diablo-app
info: Activating snapshot 0.0.0-11 for diablo-app
info: Starting app diablo-app
error: Error running command deploy
error: Nodejitsu Error (500): Internal Server Error
warn: Error returned from Nodejitsu
error: Error: connect ECONNREFUSED
error: at errnoException (net.js:768:11)
error: at Object.afterConnect [as oncomplete] (net.js:759:19)