# Quick Start: Using the Hook Library & JSON Orchestration ## 5-Minute Quick Start ### 1. Use a Data Hook ```typescript import { useFiles } from '@/hooks/data' function MyComponent() { const { files, addFile, updateFile } = useFiles() return (
{files.map(file => (
{file.name}
))}
) } ``` ### 2. Create a Simple Page Schema ```json { "id": "my-page", "name": "My Page", "layout": { "type": "single" }, "components": [ { "id": "title", "type": "h1", "props": { "children": "Hello World" } }, { "id": "button", "type": "Button", "props": { "children": "Click Me" }, "events": [ { "event": "onClick", "action": "show-alert" } ] } ], "actions": [ { "id": "show-alert", "type": "custom", "handler": "alert('Clicked!')" } ] } ``` ### 3. Render the Page ```typescript import { PageRenderer } from '@/components/orchestration' import myPageSchema from '@/config/pages/my-page.json' function App() { return } ``` ## Common Patterns ### Pattern 1: List with CRUD ```typescript import { useModels } from '@/hooks/data' import { useDialog } from '@/hooks/ui' function ModelList() { const { models, addModel, updateModel, deleteModel } = useModels() const { isOpen, open, close } = useDialog() return ( <> {models.map(model => (
{model.name}
))} {/* Add form */} ) } ``` ### Pattern 2: Master-Detail ```typescript import { useFiles } from '@/hooks/data' import { useState } from 'react' function FileEditor() { const { files, updateFileContent } = useFiles() const [selectedId, setSelectedId] = useState(null) const selectedFile = files.find(f => f.id === selectedId) return (
{files.map(file => ( ))}
{selectedFile && (