The hook with logic is something I already saw to separate logic from JSX.
It makes the code cleaner and you have different things in different places and is certainly something that should be used more.
That said, I had times I stopped at the second refactor because the component was a "one of a kind", it was also inside something that didn't need to know about how the "select" worked internally. So this let me expose to the parent only what it needed to know while hiding the details it didn't need to know.
I wouldn't recommend it save a few occasions you find yourself having to have a lot of details from the child being controlled by the parent. (Also, it's a lot easier to do than using something like an imperative handle.)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
The hook with logic is something I already saw to separate logic from JSX.
It makes the code cleaner and you have different things in different places and is certainly something that should be used more.
That said, I had times I stopped at the second refactor because the component was a "one of a kind", it was also inside something that didn't need to know about how the "select" worked internally. So this let me expose to the parent only what it needed to know while hiding the details it didn't need to know.
I wouldn't recommend it save a few occasions you find yourself having to have a lot of details from the child being controlled by the parent. (Also, it's a lot easier to do than using something like an imperative handle.)