Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What does @format mean in new react native App.js?

Tags:

I started to create an Application in react native so, i setup the react native environment and found the @format in the App.js file when i open this file first time. Please can anyone tell what is @format and why it is in the new App.js file in react native?

like image 538
Stack Overflow Avatar asked Nov 13 '18 11:11

Stack Overflow


People also ask

How much RAM do I need for React Native?

3) Android requires the least amount of memory (205 Mb); React Native needs 280 Mb and Flutter requires 266 Mb.

How do I reduce image loading time in React Native?

If you're looking for a way to speed up your React Native app, react-native-fast-image is a great option. By caching images, react native fast image can help reduce the number of bytes that need to be downloaded, which can lead to faster load times.

Does React Native support 120fps?

Description. When running a react native app on a device that has a refresh rate other than 60, react native apps still run at 60 fps. This means that if you have a device like a Samsung Galaxy S20, which runs at 120 fps, every react native app will feel sluggish, slow and underperforming.


1 Answers

Refer to the @Noitidart's link in comment, the @format is part of pragma and another pragma is @prettier. Prettier will only format those files with pragma when option of Require pragma is enabled. Thanks @Noitidart for the link.


I found this after I check the blame of App.js file in react native repo.

Prettier RN local-cli

And I found this description in RN 0.48.4 features Enforce Prettier for @format (1023070) - @TheSavior

As conclusion, the @format tag is used to tell the prettier tool to run on that file and so that it's format becomes prettier.

like image 121
V-SHY Avatar answered Sep 21 '22 16:09

V-SHY