React API Reference
useBuilderStore
This React hook creates a builder store.
Reference
useBuilderStore(builder, options?)
Use the useBuilderStore
function to create a builder store.
import { useBuilderStore } from "@coltorapps/builder-react";
import { formBuilder } from "./form-builder";
export function App() {
const builderStore = useBuilderStore(formBuilder);
}
Parameters
useBuilderStore
accepts two parameters:
Parameter | Type | Description |
---|---|---|
builder | object | The builder definition. |
options | object optional | An optional partial object with initialization options. |
You should know!
Ensure that the provided builder
parameter remains stable or is memoized. The builder store will be recreated if the builder
reference changes, leading to data loss.
Options
The options
parameter properties:
Property | Type | Description |
---|---|---|
initialData | object optional | The optional partial initial data of the builder store. |
Returns
The useBuilderStore
function essentially creates and returns a builder store.