About the Author

James Slaughter

I’m a software developer from Kansas City who loves being a dad, making and listening to music, and appreciating nature. I’ve led software teams and have worked with clients to find the right solution for them. I have my Bachelor’s in Mathematics and Statistics, and approach programming and problem solving as an exercise in those skills. At Children’s Mercy, I led a software team in the growing Children’s Research Institute, managing and developing their regulatory and grants systems. After 8 years of growth I worked for Huron Consulting Group, where I worked closely with a large education system getting their disparate, siloed research business applications integrated. I understand the challenges that legacy systems and processes face and have led successful change management with my clients, including the rollout of a conflict of interest management system that has over 100,000 users. I’ve worked quite a lot with MS SQL Server, Windows Server, and Linkx. I’ve also done freelance work over the past year using React and Electron. I’m very comfortable with both the frontend and the backend. I try to stay away from the screen in my spare time: finding new places to hike and practice plant identification and foraging, or, I’ll be twiddling up new sounds on my hardware synthesizers. I love spending quality time with my kids, ages 12, 10, and 3, and we keep plenty busy! This summer we found a couple of caterpillars that we are raising, and are exploring the creek by our apartment.

Why Functional Programming

James Slaughter Development Technologies, JavaScript, React Leave a Comment

React has gotten a little funny of late – a few years ago, it was normal to embrace the Object-Oriented paradigm, writing each component as a class and doing lots of this-binding.

Today, however, hooks and functional components have taken over React, and with it, a style of programming unusual for front-end frameworks is growing in popularity: Functional Programming.

This programming style has been in use for many years: Lisp, Haskell, Clojure, and OCaml are all established, though mainly out of the mainstream, languages with a rich history and broad application. Thinking ‘functions are first-class citizens’ sounds strange, especially to new JavaScript developers who have spent most of their time in Python or Java that come from an Object-Oriented perspective.

That’s why in this post, we will go over the basics of Functional Programming, how we compose functions, a handy implementation of a ‘pipe’ function that will compose functions, the process of currying and functions-as-return-value, and how we can use these concepts in React using Higher-Order Components.