Using Core Node JS Modules in React Native Appsby@aakashns
25,465 reads

Using Core Node JS Modules in React Native Apps

April 9th 2020
4 min
by @aakashns 25,465 reads
tldt arrow
Read on Terminal Reader🖨️

Too Long; Didn't Read

React Native can’t package core Node JS modules into React Native, so you get a runtime error. This makes core modules like crypto modules like that of the Node JS binary unusable from React Native. Fortunately, there’s a solution to this problem, but it takes some work. There is a hacky but simple way to fix this problem with React Native: create a standalone Javascript file that contains a polyfill for themodule and use it within our app. The last few lines of the file contain our code from the polyfills.

Company Mentioned

Mention Thumbnail

Coin Mentioned

Mention Thumbnail
featured image - Using Core Node JS Modules in React Native Apps
Aakash N S HackerNoon profile picture

@aakashns

Aakash N S
react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!
Hackernoon hq - po box 2206, edwards, colorado 81632, usa