Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is React Native's bundle, and its purpose?

I'm trying to understand what the bundle exactly is and what its purpose is, what I can or can't do with it, ...

I see that when you run the command 'react-native start' the packager is initialized which will be used when you're running the app on a device/simulator with 'react-native run-android' or '.. run-ios'. In the output of the packager you can see a package being built. You can also see this package being built when using android gradle commands like 'gradle assembleRelease' in the android folder.

I know that it bundles the javascript code. I've also seen some info on how to 'use an offline bundle'. (What does that mean exactly?)

I appreciate any help in finding clear information on this, as I would really want to know why people would use an offline bundle for example.

like image 637
FDMatthias Avatar asked Jan 31 '17 15:01

FDMatthias


People also ask

What is bundle in React?

Most React apps will have their files “bundled” using tools like Webpack, Rollup or Browserify. Bundling is the process of following imported files and merging them into a single file: a “bundle”. This bundle can then be included on a webpage to load an entire app at once.

What is the purpose of React Native?

React Native is an open-source JavaScript framework, designed for building apps on multiple platforms like iOS, Android, and also web applications, utilizing the very same code base. It is based on React, and it brings all its glory to mobile app development.

What is React Native and how it works?

React Native (also known as RN) is a popular JavaScript-based mobile app framework that allows you to build natively-rendered mobile apps for iOS and Android. The framework lets you create an application for various platforms by using the same codebase.


Video Answer


1 Answers

The bundle is indeed 'the javascript'. In development the bundle likely will come from your react-native start development server. That way if your code is changed the server will send a request to the client, through a websocket, to download the new code or update the code on the fly. So, you could say the bundle is dynamically generated from your source code. In production you probably want to use an offline bundle so that your code is already on the device and does not need to be downloaded.

For more info: Running on Device (http://facebook.github.io/)

like image 170
JJJ Avatar answered Sep 27 '22 21:09

JJJ