Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

metro-react-native-babel-preset

Package Overview
Dependencies
Maintainers
2
Versions
100
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

metro-react-native-babel-preset

Babel preset for React Native applications

  • 0.77.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
2M
increased by8.62%
Maintainers
2
Weekly downloads
 
Created

What is metro-react-native-babel-preset?

The metro-react-native-babel-preset package is a Babel preset for React Native applications. It includes the Babel plugins and configurations necessary to compile JavaScript code in a way that is compatible with the React Native platform. This preset helps developers by abstracting the complex Babel configurations required for React Native development.

What are metro-react-native-babel-preset's main functionalities?

Transform JSX

This code sample demonstrates how JSX is transformed into JavaScript that React Native can understand. The metro-react-native-babel-preset handles the necessary transformations behind the scenes.

import React from 'react';
import { View, Text } from 'react-native';

function MyComponent() {
  return (
    <View>
      <Text>Hello, world!</Text>
    </View>
  );
}

ESNext Features

This code sample shows the use of class properties, an ESNext feature. The preset allows developers to write modern JavaScript by transpiling features that are not natively supported by the React Native JavaScript engine.

class MyComponent extends React.Component {
  state = { greeting: 'Hello' };

  render() {
    return <Text>{this.state.greeting}, world!</Text>;
  }
}

Module Resolution

This code sample illustrates module resolution. The preset configures Babel to resolve modules in a way that is compatible with the Metro bundler used by React Native.

import myModule from 'my-module';

Other packages similar to metro-react-native-babel-preset

Keywords

FAQs

Package last updated on 06 Jul 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc