From Mixins to Custom Hooks: History of Sharing in React

From Mixins to Custom Hooks: History of Sharing in React

Ben Ilegbodu takes a history lesson on sharing in React in order to better understand how modern day custom hooks work and the problems they solve. From Mixins to Custom Hooks: History of Sharing in React

Summary

Ben Ilegbodu takes a history lesson on sharing in React in order to better understand how modern day custom hooks work and the problems they solve.

Bio

Ben Ilegbodu has 15 years of professional experience developing user interfaces for the Web. He currently is a Principal Front-end Engineer at Stitch Fix on their Front-end Platform team, helping architect their Design System and build out their front-end.

About the conference

QCon Plus is a virtual conference for senior software engineers and architects that covers the trends, best practices, and solutions leveraged by the world's most innovative software organizations.

Transcript

Ilegbodu: I am super excited to be a part of QCon sharing about sharing in React. We're basically going to go on a six-year journey with React, from mixins in the beginning to hooks right now. React's approach to building UIs makes sharing and reuse great. React is especially great at sharing UI. Here we have a slideshow component. No doubt, it has lots of markup, styling, and UI logic. We can easily use it in two components. We have the players component on the left, that has a slideshow of team players pictures. Then on the right, we have a teams component to have a slideshow of team logos.

Sharing Utilities and Non-Visual Logic

Because React is basically just JavaScript, sharing helper functions is great too. We can call API utilities, data transformation helpers, and all sorts of different functions within our React component code. The tricky part is the stateful non-visual logic aspect. Here we've got the players and teams components again, but this time, they're rendering a different UI. On the left, we have the slideshow component. On the right, we have the ImageList component. They can both call the same API. They both need to maintain state images or logos. Both of them actually need to call the API again, when the page changes. They have similar state and similar logic, but different UI. We want to be able to share that state and share that UI so that whenever someone paginates through the user interface, or logos, it'll all work. We can put this data in a slideshow, in a list view, in a grid view, or whatever. We don't want to repeat that stateful non-visual logic. What I want to do is take us on a journey of how we've tried to solve this problem over React's lifetime.

javascript react web development transcripts

What is Geek Coin

What is GeekCash, Geek Token

Best Visual Studio Code Themes of 2021

Bootstrap 5 Tutorial - Bootstrap 5 Crash Course for Beginners

Nest.JS Tutorial for Beginners

Hello Vue 3: A First Look at Vue 3 and the Composition API

How native is React Native? | React Native vs Native App Development

Article covers: How native is react native?, React Native vs (Ionic, Cordova), Similarities and difference between React Native and Native App Development.

Hire Dedicated JavaScript Developers -Hire JavaScript Developers

Hire dedicated JavaScript Developers who are proficient in AngularJS, ReactJS, NodeJS, & VueJS frameworks. Get flexible hiring models as per your business requirements.

React Native App Developers India, React Native App Development Company

Hire React Native app developers India from a preferred React Native app development company by innovative industry leaders. Let's Discuss Your Project.

Hire India's Best React JS Developers| Hire React JS Development Company

Looking to hire top dedicated Reactjs developers in India at affordable prices? Our 5+ years of average experienced Reactjs developers comprise proficiency in delivering the most complex and challenging web apps. Hire ReactJS development...

Top React JS Development Company | React JS Development Services

As a leading React.js development company, our development team has created reusable React.js components, large-scale websites, and interactive user interfaces for global clients. 4200+ Projects | 16+ Yrs Exp