import React, { useMemo } from 'react'; import PropTypes from 'prop-types'; import s0 from './ToggleSwitch.module.css'; function ToggleSwitch({ options, value, name, onChange }) { const idxSelected = useMemo(() => options.map(o => o.value).indexOf(value), [ options, value ]); const w = (100 / options.length).toPrecision(3); return (