The Present of Lodash

Given the announcement of “The Future of Lodash”, with Lodash joining OpenJS, I thought I’d express my ongoing love for Lodash and share one of the many reasons why it is still useful for me day-to-day.

TL;DR Merge is an unsung hero of the library.

I…


This content originally appeared on DEV Community and was authored by Benjamin Black

Given the announcement of "The Future of Lodash", with Lodash joining OpenJS, I thought I'd express my ongoing love for Lodash and share one of the many reasons why it is still useful for me day-to-day.

TL;DR Merge is an unsung hero of the library.

In the absence of something like Immer, if you need to immutably update a deeply-nested object, you can do this:

const properties = { /* ... */ };

setTracks((prev) => ({
    ...prev,
    [trackId]: {
        ...prev[trackId],
        points: {
            ...prev[trackId].points,
            [pointId]: {
                ...prev[trackId].points[pointId],
                properties: {
                    ...prev[trackId].points[pointId].properties,
                    ...properties,
                }
            }
        }
    }
}));

Or you can do this:

setTracks((prev) => 
    merge({}, prev, {[routeId]: {points: {[pointId]: {properties}}}}))
);


This content originally appeared on DEV Community and was authored by Benjamin Black


Print Share Comment Cite Upload Translate Updates
APA

Benjamin Black | Sciencx (2025-10-23T15:04:08+00:00) The Present of Lodash. Retrieved from https://www.scien.cx/2025/10/23/the-present-of-lodash/

MLA
" » The Present of Lodash." Benjamin Black | Sciencx - Thursday October 23, 2025, https://www.scien.cx/2025/10/23/the-present-of-lodash/
HARVARD
Benjamin Black | Sciencx Thursday October 23, 2025 » The Present of Lodash., viewed ,<https://www.scien.cx/2025/10/23/the-present-of-lodash/>
VANCOUVER
Benjamin Black | Sciencx - » The Present of Lodash. [Internet]. [Accessed ]. Available from: https://www.scien.cx/2025/10/23/the-present-of-lodash/
CHICAGO
" » The Present of Lodash." Benjamin Black | Sciencx - Accessed . https://www.scien.cx/2025/10/23/the-present-of-lodash/
IEEE
" » The Present of Lodash." Benjamin Black | Sciencx [Online]. Available: https://www.scien.cx/2025/10/23/the-present-of-lodash/. [Accessed: ]
rf:citation
» The Present of Lodash | Benjamin Black | Sciencx | https://www.scien.cx/2025/10/23/the-present-of-lodash/ |

Please log in to upload a file.




There are no updates yet.
Click the Upload button above to add an update.

You must be logged in to translate posts. Please log in or register.