I would like to ask you a question. There was a dispute between me and my friend about this moment
Suppose we have a table / form, its data is stored in the redux store, respectively. And we have a button that should be turned on or off, depending on the validation of the data. It seemed strange to clog up my component or container with validation logic(in my opinion), and I put all the validation logic to the selector, which simply returned true / false for the button.
Is validation in selector a good practice? Is it a good practice to prepare data in selector in case if we I don't need recomputing?
Thank you in advance.
I don’t think it matters much. Either way is probably fine. If you expect to use this validation in other places or if recomputing it is expensive then yea, sure, extract it.
We're a place where coders share, stay up-to-date and grow their careers.
We strive for transparency and don't collect excess data.