DEV Community

Discussion on: Add a unique id and use it as a key

Collapse
 
lexlohr profile image
Alex Lohr

Unless you can make use of tree-shaking, you should use a dedicated package instead of lodash, because otherwise all of lodash is going to be included in your package.

Collapse
 
ahyagoub40 profile image
Ahmed Yagoub

Correct,
can probably 'cherry pick' the method
npm i --save lodash.uniqueid
and import it in the file as so
import uniqueId from 'lodash.uniqueid'
The main reason I went with lodash because it might already be used in the project, if it is not, I agree with you on using a dedicated package
Thanks for reading and for your comment