Egghead Instructor Paul Frend

Paul Frend

I like to think hard about how complex things can be made simple. Into functional programming goodness. Senior Software Engineer @ConsoleConnect



Support Paul's Free Lessons
become a member today

Browse Paul Frend's lessons.

showing 1 lessons...

Refactor Business Logic to Composable Functions with Lodash

js tutorial about Refactor Business Logic to Composable Functions with Lodash

Refactor Business Logic to Composable Functions with Lodash

4:45 js

Imagine if looking at your business logic read as simple as a story from a children's book. That's exactly what we'll cover by learning how to compose small pieces of business logic and also set them up for further composition in the future.

We're showing a list of fictional tweets in a trivial React component created with create-react-app, however the example is not React specific and can be applied to any framework/environment.

Our example will refactor out business logic from a non-composable function to small composable pieces. To accomplish this we'll be using flow, filter and map from lodash/fp, which is included in the regular lodash npm package.

This approach works well in any environment where you're not relying on object references to your original data, as our functional approach creates new collection objects instead of mutating them.

Guide to lodash/fp: https://github.com/lodash/lodash/wiki/FP-Guide

HEY, QUICK QUESTION!
Joel's Head
Why are we asking?