Using Core Node JS Modules in React Native Appsby@aakashns
26,752 reads

Using Core Node JS Modules in React Native Apps

July 2nd 2017
3m
by @aakashns 26,752 reads
tldt arrow
Read on Terminal Reader
Read this story w/o Javascript

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
featured image - Using Core Node JS Modules in React Native Apps
Aakash N S HackerNoon profile picture

@aakashns

Aakash N S

Receive Stories from @aakashns

react to story with heart

RELATED STORIES

L O A D I N G
. . . comments & more!