I've been using this approach in a couple of projects now, and I must say it's a pleasure to work with and saves a lot of repetitive coding, and improves UX easily.
I've now rewritten it to use less code (thanks to the hooks API) and I added some examples and wrappers for popular UI libraries (semantic-ui-react, react-bootstrap, antd, plus Material UI example)