import React, {useMemo} from 'react'; import BrowserOnly from '@docusaurus/BrowserOnly'; import {GREG_CORE_SNIPPETS} from '../data/gregCoreSnippets'; type Props = { /** e.g. "Random sample from gregCore" */ caption: string; }; /** * Picks one snippet per client mount (stable for that visit; no SSR/CSR mismatch). */ function GregCoreRandomSnippetInner({caption}: Props): JSX.Element { const snippet = useMemo( () => GREG_CORE_SNIPPETS[Math.floor(Math.random() * GREG_CORE_SNIPPETS.length)], [], ); return (
{caption}
{snippet.title} · {snippet.sourcePath}
          {snippet.code.trimEnd()}
        
); } export function GregCoreRandomSnippet(props: Props): JSX.Element { return (
Loading code sample…
}> {() => } ); }