Skip to content

Backroad IDs

Backroad internally generates the id value for every component if you don’t specify it. This id is used to map values to backroad components across re-runs. The auto-generated id is generated by using a combination of the props you pass to the component. But note that this is not a bullet-proof solution since backroad will get confused between two components which have the exact same inputs to it. So makes sure you specify the component id when your use case requires it.

// Problematic usage
const num1 = br.numberInput({ defaultValue: 5 });
const num2 = br.numberInput({ defaultValue: 5 });

// Correct usage
const num1 = br.numberInput({ id: "num-1", defaultValue: 5 });
const num2 = br.numberInput({ id: "num-2", defaultValue: 5 });