The flatMapDeep
function in lodash can be used to recursively flatten an array of nested arrays, and apply a callback function to each element in the array. Here's an example of how you can use it:
index.tsx368 chars16 lines
In the example above, we're using _.flatMapDeep
to flatten the array
recursively and apply a callback function to each element in the array. The result is a new array with each element doubled.
Note that flatMapDeep
is part of the lodash
library, so you'll need to install it before you can use it. You can install it via NPM:
index.tsx19 chars2 lines
gistlibby LogSnag