This video is a talk from Byteconf React 2020, a free, live-streamed React conference that aired on May 1st-2nd, 2020. Join our newsletter at the conference website to stay in the know about future conferences, videos, and more!
One of the things I love about React is how easy it is to encapsulate UI code into a component or hook. I love this because it makes reuse of those things easy. But is it easy? I've made my fair share of components that had to accept a bunch of props to handle a growing list of different use cases resulting in a complex render function full of conditional statements and a confusing API for people using this "reusable" component. Eventually it becomes too much and I had to make a new version of the same component to handle slightly different use cases. Lots of code/bug duplication there because my reusable component wasn't reusable enough.
There are patterns that have emerged in React that allow you to promote code reuse without sacrificing the simplicity or flexibility of the component. In this talk we'll go over several of these patterns that will make your React components and hooks more useful.
If you enjoyed the video, give it a thumbs-up, and subscribe to our channel for more web dev content every week. We also have a newsletter where we send out what's new and cool in the web development world, every Tuesday – join here!