Skip to content

Instantly share code, notes, and snippets.

@codesandbox/context

A more powerful createContext API for React

Install

npm install @codesandbox/context

Maintainer needed

I have gotten to a point now where I realize my open source work is not sustainable in combination with family. I have spent a ton of time over the years developing ideas, learning, sharing and engaging with the open source community. It has been a lot of fun, but also exhausting. There is a dark side to doing open source, at least for me. Even though it is a recipe for learning I have also been spending most of my time lost in thought. Thinking about ideas, issues and craving recognition for the stuff that I share. It is not a healthy way to live your life. The cost/benefit was okay for a long time as the only people who were affected by it was my partner and myself, but now with 2 kids I have to stop... I should have stopped when we had our first kid. Sitting for 30 min next to our 4 year old daughter and not even noticing it, because I am working out this new idea in my head. Being impatient and annoyed at our 10 month year old son, because I am amped up by some bug I can not stop thin

const reducer = (context, event) => {
switch (event.type) {
case 'FETCH':
return {
...context,
state: 'fetching',
};
case 'RESOLVE':
return {
state: 'fulfilled',
type ProviderPitcherRequest<T extends Provider> = T["onRequest"] extends (
request: infer Req,
dispatcher: Dispatcher<any, any>,
client: Client
) => void
? Req
: never;
type ProviderPitcherResult<T extends Provider> = T["onRequest"] extends (
request: any,

Updated packages

package from version to version
betsy 1.0.2 1.0.2-1624519707403
overmind 27.0.0 28.0.0-1624519707403
overmind-devtools 28.0.0 29.0.0-1624519707403
overmind-devtools-client 10.0.0 11.0.0-1624519707403
overmind-devtools-vscode 9.0.0 10.0.0-1624519707403
overmind-graphql 7.0.0 8.0.0-1624519707403

Migration

The next version of the docs can be found here: https://overmindjs.org/v/v28

Overmind typing

The implicit typing has been completely removed, meaning you have to explicitly type your application. That said, the explicit typing is way simpler then in the previous version. This is all of it:

import { IContext } from 'overmind'
#!/usr/bin/env node
const cors = require('cors')
const chalk = require('chalk')
const figures = require('figures')
const express = require('express')
const bodyParser = require('body-parser')
const { resolve, relative } = require('path')
const jscodeshift = require('jscodeshift/dist/Runner')
const argv = require('yargs-parser')(process.argv.slice(2))
const tree = {
auth: {
user: {}
},
issues: {
list: []
},
projects: {
list: [],
filter: 'completed'
@christianalfoni
christianalfoni / background.js
Created November 10, 2020 10:41
element-capture
chrome.extension.onMessage.addListener(function(request, sender, sendResponse) {
console.log("request type", request.type)
if (request.type === "enable") {
chrome.pageAction.show(sender.tab.id);
}
else if (request.type === "up") {
capture(sender.tab.id, request.dimensions);
}
sendResponse({});
@christianalfoni
christianalfoni / self-signed-wildcard-ssl-for-nginx.sh
Last active August 24, 2020 09:54 — forked from mikepsinn/self-signed-wildcard-ssl-for-nginx.sh
Create self-signed SSL certificate for Nginx
#!/usr/bin/env bash
# sudo apt-get install -y curl
# curl https://gist.githubusercontent.com/mikepsinn/b1142aa685ef71d6d3af9b01fc386539/raw/self-signed-wildcard-ssl-for-nginx.sh | sudo bash -s
ROOT_DOMAIN=codesandbox.test
# Specify where we will install
SSL_DIR="ssl"
# Set the wildcarded domain we want to use
WILDCARD_DOMAIN="*.${ROOT_DOMAIN}"