Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const SensorFusionProvider = ({ children, ...extraProps }) => {
const { sampleInterval } = extraProps;
const [ ahrs, setAhrs ] = useState(
new Ahrs(extraProps),
);
const [
filters,
setFilters,
] = useState(
createFilters(),
);
const [ gyro ] = useState([ 0, 0, 0 ]);
const [ accl ] = useState([ 0, 0, 0 ]);
const [ comp ] = useState([ 0, 0, 0 ]);
const get = [ gyro, accl, comp ];
const [ value, setValue ] = useState(
{
ahrs,
gyro,
accl,
() => {
const ahrs = new Ahrs(extraProps);
const filters = createFilters();
setAhrs(ahrs);
setValue({ ahrs, gyro, accl, comp });
setFilters(
filters,
);
},
Object.keys(extraProps),