React Native - Why do I need babel or webpack?

前端 未结 1 1065
轮回少年
轮回少年 2021-02-05 06:40

I am new pretty new in Javascript world and I am trying to learn and understand React Native.

Why do I find babel and webpack in so many react-native boilerplate

相关标签:
1条回答
  • 2021-02-05 07:40

    Babel is already included with react-native so you have the option of either writing in ES6+ or the older ES5 style.

    To clarify, React-native runs on the javascript core on mobile, this means its not in a browser but still renders the JS code so babel is there, in-between, to allow you to write next gen JS code and use React's JSX code.

    Here is a list of supported ES6+ features

    Some people want additional features not in Babel that ships with react-native so they end up using webpack and custom Babel configurations. Recently they've added support for things like async functions (ES7) so personally, i don't think you need to go the webpack route unless you have a very specific need.

    0 讨论(0)
提交回复
热议问题