{title}
{content}
} {() =>This post is not yet published.
}### Install rEFui and refurbish dependencies with bun Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Installs the 'refui' library and 'refurbish' (for HMR) using bun. These are essential for running rEFui applications with Vite. ```bash bun add refui bun add -d refurbish ``` -------------------------------- ### Run Vite development server with bun Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Command to start the Vite development server using bun. This command compiles the project and serves it locally for development. ```bash bun run dev ``` -------------------------------- ### Install rEFui and refurbish dependencies with npm Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Installs the 'refui' library and 'refurbish' (for HMR) using npm. These are essential for running rEFui applications with Vite. ```bash npm i refui npm i -D refurbish ``` -------------------------------- ### Install rEFui and refurbish dependencies with pnpm Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Installs the 'refui' library and 'refurbish' (for HMR) using pnpm. These are essential for running rEFui applications with Vite. ```bash pnpm add refui pnpm add -D refurbish ``` -------------------------------- ### Install rEFui and refurbish dependencies with yarn Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Installs the 'refui' library and 'refurbish' (for HMR) using yarn. These are essential for running rEFui applications with Vite. ```bash yarn add refui yarn add -D refurbish ``` -------------------------------- ### esbuild JSX Setup - Classic Pragma (Shell) Source: https://github.com/sudomaker/refui/blob/main/docs/pages/guides/faq.mdx Command-line example for setting up esbuild with the classic JSX pragma. This is useful for per-file renderer swapping or Reflow classic patterns. ```shell esbuild src/main.jsx --bundle --outfile=dist/bundle.js --jsx-factory=R.c --jsx-fragment=R.f ``` -------------------------------- ### Run Vite development server with npm Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Command to start the Vite development server using npm. This command compiles the project and serves it locally for development. ```bash npm run dev ``` -------------------------------- ### Run Vite development server with yarn Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Command to start the Vite development server using yarn. This command compiles the project and serves it locally for development. ```bash yarn dev ``` -------------------------------- ### Run Vite development server with pnpm Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md Command to start the Vite development server using pnpm. This command compiles the project and serves it locally for development. ```bash pnpm dev ``` -------------------------------- ### esbuild JSX Setup - Automatic Runtime (Shell) Source: https://github.com/sudomaker/refui/blob/main/docs/pages/guides/faq.mdx Command-line example for setting up esbuild with the automatic JSX runtime. This is the default for most applications and pairs well with Reflow. ```shell esbuild src/main.jsx --bundle --outfile=dist/bundle.js --jsx=automatic --jsx-import-source=refui ``` -------------------------------- ### Basic rEFui root component with a counter (JavaScript) Source: https://github.com/sudomaker/refui/blob/main/skills/refui/references/project-setup.md A simple 'App' component for rEFui that demonstrates state management using signals and event handling for a button click. ```jsx import { signal } from 'refui' export default function App() { const count = signal(0) return (
This is rendered on the server.
> ); } // 3. Render the component to a variable const rendered = renderer.createElement(App); // 4. Serialize the output to an HTML string const htmlString = renderer.serialize(rendered); console.log(htmlString); // Output:This is rendered on the server.
``` -------------------------------- ### Create and Render 'Hello, World!' Component (index.jsx) Source: https://github.com/sudomaker/refui/blob/main/docs/pages/getting-started.mdx Demonstrates the creation of a simple 'Hello, World!' component and its rendering to the DOM using rEFui. It involves creating a DOM renderer and calling the render method with the target element and the component. ```jsx import { createDOMRenderer } from 'refui/dom'; import { defaults } from 'refui/browser'; // 1. Create a DOM renderer instance const renderer = createDOMRenderer(defaults); // 2. Define your component const App = () => { returnWelcome back!
} {() =>Please log in.
}{content}
} {() =>This post is not yet published.
}Loading user...
} catch={({ error }) =>Error: {error.message}
} > {({ result: user }) =>Welcome, {user.name}!
}You have {count} messages
Detailed view created once
) const renderSummary = useMemo((R) =>Summary created once
) const ToggleMessage = () => { const isOpen = signal(false) return (Count is: {count.value}
{message}