Skip to content

Instantly share code, notes, and snippets.

@sibelius
sibelius / useFastField.tsx
Last active May 10, 2023 04:07
useFastField that uses local state `onChange` and sync back to formik only `onBlur`
import React, { useState, useEffect } from 'react';
import { useField, FieldHookConfig, FieldInputProps, FieldMetaProps, FieldHelperProps } from 'formik';
import { useDebouncedCallback } from 'use-debounce';
const DEBOUNCE_DELAY = 300;
export function useFastField<Val = any>(
propsOrFieldName: string | FieldHookConfig<Val>,
): [FieldInputProps<Val>, FieldMetaProps<Val>, FieldHelperProps<Val>] {
const [field, meta, helpers] = useField<Val>(propsOrFieldName);
@BenSimonds
BenSimonds / README.md
Last active November 23, 2021 19:43
Square Grid with d3

Grid 1. with d3

Trippy grid of squares. Click to show wireframe.

@mbostock
mbostock / .block
Last active March 13, 2024 01:33
Bar Chart with Negative Values
license: gpl-3.0
redirect: https://observablehq.com/@d3/diverging-bar-chart