Finally! Thank you! It's amazing to see advanced concepts being taught the right way as well as having error handling included in your code! Most videos out there stay away from either of the subjects because it's hard (or they are not proficient in it), which gives junior devs a false image of how to develop real-life production-ready applications.
Thanks for making this. Just one doubt in the ISP example. Does'nt the UserProfileGOOD violate OCP? Currently, every time we need to add a new notification type, we have to modify the UserProfileGOOD component to include the new notification component. This violates OCP because the component is not closed for modification.
Thanks, some very insightful examples here. That said... IMO, example of cleaning the validation code was confounded by the use of the external package. The main point to me was that the validation code could be extracted to a module-level function, instead of being in-line to the component. Likewise, use of a library to handle the form meant that the `InputField` component was tightly coupled to this library (via the `fieldRegister` property.)
Curious if you prefer react hook form and zod over formik and yup for a reason or it’s just a combination you have been using and don’t need anything else?
can anyone please tell me how the SRP was being violated in the first example. I mean if we look from a feature perspective that single component was binding the login stuff and only login stuff. i mean where is the borderline. how to distinguish ?
You're thinking is right mate. Few mature tech leads would have you perform the extraction into sub components in a case like this, I think. But for a form of 20 inputs, it would make sense. Not because of srp though. Just readability. IMO anyway
@oladayoagbolade3676 not quite. This separation is an opinionated practice, wrongly packaged as SRP-related. In SRP the responsibilities are defined in terms of the app functionality, not in terms of the programming mechanics. This is a common misunderstanding in web development.
What you didn't mention regarding the showcase of OCP is that the so-called compound components are gonna double or triple the size of code. I personally don't recommend use compound components everywhere.
I really like your videos on clean code and this one is very useful as well. For the React Days where I was participating I would have hoped for some kind of different content, you just recycled your youtube content unfortunately. React Days Ticket costs a lot of money.