0
votes

I am unable to import loadash to react native app.

Steps Followed:

1- NPM Install npm install loadash --save

2- Import import _ from 'loadash' Tried importing like this also : let _ = require('loadash');

3- Usage _.isUndefined(Key);

Package.json

"dependencies": {
"lodash": "^4.17.5",
"react": "16.2.0",
"react-native": "0.53.3"

}

Any Solution will be welcome, I tried removed node_modules and installing again also I tried these below steps:

  • Clear watchman watches: watchman watch-del-all.
  • Delete the node_modules folder: rm -rf node_modules && npm install.
  • Reset Metro Bundler cache: rm -rf $TMPDIR/react-* or npm start -- --reset-cache.
  • Remove haste cache: rm -rf $TMPDIR/haste-map-react-native-packager-*.

Thanks.

1

1 Answers

2
votes

You have a typo, it's lodash, not loadash