From the course: Build Modern Web Apps with React, Hooks, State Management, and APIs Using Vite or Next.js

Unlock this course with a free trial

Join today to access over 25,200 courses taught by industry experts.

Summary: Best practices

Summary: Best practices

Welcome back, let's review when we should use which solution. We should use the composition when we have isolated UI customization. Composition approach provides us a flexible layout. As you saw in the solution that under the parent component we can use any other component which is going to require the props and we pass on the props only to that component. In the meanwhile, it's also keeping the layering intact. On the other hand, we should use context API when we have a shared global state. When multiple components need to have the shared data. The other approach is Redux and ZooStand libraries. We are going to discuss that in great detail in the upcoming videos. It is same as of Context API but it is used when you have a complex state such as managing an e-commerce application. Let's review some best practices. one rule, we should always avoid prop drilling because it makes our code hard to maintain. Always see where the component composition can be used and possible. We should use…

Contents