I'm not sure what I'm missing/doing wrong, or if something else is going on. I'm using the reactor-router-dom package in React for simple navigation, and when I navigate to and from the Home page for example, the current and last SegmentedControlItem are both selected.
Solved! Go to Solution.
use this instead of setting checked to undefined
<CalciteSegmentedControlItem
// always selects 25 and All when coming back to page
// checked={rowsShown === rowsConstant ? true : undefined}
{...(rowsShown === rowsConstant ? { checked: true } : {})}
value={rowsConstant}
key={i}
>
{rowsConstant}
</CalciteSegmentedControlItem>
use this instead of setting checked to undefined
<CalciteSegmentedControlItem
// always selects 25 and All when coming back to page
// checked={rowsShown === rowsConstant ? true : undefined}
{...(rowsShown === rowsConstant ? { checked: true } : {})}
value={rowsConstant}
key={i}
>
{rowsConstant}
</CalciteSegmentedControlItem>
Awesome. Thank you!