diff --git a/src/App.tsx b/src/App.tsx index f0c27ea..2c0346e 100644 --- a/src/App.tsx +++ b/src/App.tsx @@ -96,6 +96,19 @@ export const App = () => { [loadJsonString], ) + const loadExample = useCallback(async () => { + try { + const response = await fetch( + "https://raw.githubusercontent.com/tscircuit/circuitjson.com/main/assets/usb-c-flashlight.json", + ) + if (!response.ok) throw new Error(`HTTP ${response.status}`) + const text = await response.text() + loadJsonString(text) + } catch (err) { + setErrorMsg("Failed to load example file. Please try again.") + } + }, [loadJsonString]) + return (
- View{" "} + Download{" "} example circuit json file