Skip to content

Instantly share code, notes, and snippets.

View mahdikhashan's full-sized avatar
🏸

Mahdi Khashan mahdikhashan

🏸
View GitHub Profile
@Aslemammad
Aslemammad / mutableSource.tsx
Last active June 1, 2024 03:34
Consistent version of useMutableSource.
// Consistent version of `useMutableSource`, Inspired by https://github.com/pmndrs/valtio/blob/master/src/useMutableSource.ts
import { useEffect, useRef, useState } from 'react';
const TARGET = Symbol('target');
const GET_VERSION = Symbol('getVersion');
export type Source<TargetType extends any, VersionType extends any> = {
[TARGET]: TargetType;
[GET_VERSION]: (target: TargetType) => VersionType;
};
@yannbf
yannbf / Instructions.md
Last active July 6, 2023 14:32
How to use a Storybook template on codesandbox

Howdy!

Storybook is a tool with countless shapes and configurations, and given that we give support to hundreds of people, it's very important to provide a minimal repo that can reproduce your issue/situation. Thanks for your effort! This will help us assist you better and faster.

And now, let's get to it!

Fork a Storybook sandbox

We will be using codesandbox in these instructions, and you will need an account.

#!/usr/bin/env bash
echo "Starting bootstrapping"
# Check for Homebrew, install if we don't have it
if test ! $(which brew); then
echo "Installing homebrew..."
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
fi