Skip to content

Instantly share code, notes, and snippets.

import { useRef, useCallback, useEffect } from 'react';
// A callback that always closes over the latest data but keeps the same
// identity and will not be called after component unmounts
const useStableCallback = callback => {
const callbackRef = useRef();
const memoCallback = useCallback(
(...args) => callbackRef.current && callbackRef.current(...args),
[],
@pierrejoubert73
pierrejoubert73 / markdown-details-collapsible.md
Last active June 29, 2024 15:54
How to add a collapsible section in markdown.

How to add a collapsible section in markdown

1. Example

Click me

Heading

  1. Foo
  2. Bar
    • Baz
  • Qux