obs-portal/frontend/src/utils.js
2021-02-26 21:57:36 +01:00

10 lines
348 B
JavaScript

// Wraps the register callback from useForm into a new ref function, such that
// any child of the provided element that is an input component will be
// registered.
export function findInput(register) {
return (element) => {
const found = element ? element.querySelector('input, textarea, select, checkbox') : null
register(found)
}
}