Flutter VS React Native –为什么我认为Flutter最适合移动应用程序开发
This isn’t the type of article you might think it’s going to be. I’m not going to list the pros and cons of every framework and I am not going to do a comparative analysis of performance.
這不是您可能會想到的文章類型。 我不會列出每個框架的優缺點,也不會對性能進行比較分析。
Over the past few weeks, I have dipped my coding hand in trying to create simple, functional applications using both frameworks. The title of this article is the conclusion I have come to from my experimentation.
在過去的幾周中,我竭盡全力嘗試使用這兩個框架創建簡單的功能性應用程序。 本文的標題是我從實驗中得出的結論。
?? Disclaimer: I am in no way stating that framework A is better than framework B and I have not been paid by neither to give my opinion. This is solely an article based on my personal experience and nothing more.
Dis?免責聲明:我絕不說框架A比框架B更好,而且我也沒有給我任何意見。 這只是一篇基于我個人經驗的文章,僅此而已。
一些背景 (Some Background)
While I am not familiar with either Dart or React, I have some background in JavaScript and more than my fair share of Native development. Since these two frameworks are relatively new and are offering the same type of development experience, I thought I’d give them a try to see what the whole fuss is about. Granted, I am not profoundly adept in the whole logic of both and I have yet to fully understand the state component in React or the component hierarchy in Dart. With that being said, I set out to create a basic application in both platforms. The premise for the application? One that would accept user input, and on a touch of a button will display the user input in some sort of list that the user can scroll through on the screen.
盡管我對Dart或React都不熟悉,但我對JavaScript有一定的了解,并且對本機開發有相當的了解。 由于這兩個框架相對較新,并且提供了相同類型的開發經驗,所以我認為我將嘗試嘗試一下整個過程。 當然,我對這兩者的整體邏輯并不十分精通,并且我還沒有完全理解React中的狀態組件或Dart中的組件層次結構。 話雖如此,我著手在兩個平臺上創建一個基本應用程序。 申請的前提? 接受用戶輸入并按一下按鈕的用戶將以某種列表顯示用戶輸入,用戶可以在屏幕上滾動瀏覽。
我的React (My REACT-ion)
I first started working on the application using React Native. Setting up the project was very simple. All you had to do was follow through on the instructions in the Getting Started documentation. I installed Expo and within minutes, my application was loading on my phone. I really appreciated the speed in which the QR code scanner of the Expo application identifies the code on the screen. Expo’s interface on the computer was also really straight forward. You can see the status of the application (building or failing), boot up an Android/iOS emulator and more. Now it was time to put my own logic into the application. This is where things got frustrating.
我首先開始使用React Native來處理應用程序。 設置項目非常簡單。 您所要做的就是按照《 入門指南》文檔中的說明進行操作。 我安裝了Expo,并在幾分鐘之內將我的應用程序加載到手機上。 我非常感謝Expo應用程序的QR碼掃描器在屏幕上識別代碼的速度。 Expo在計算機上的界面也非常簡單。 您可以查看應用程序的狀態(正在構建或正在失敗),啟動Android / iOS模擬器等。 現在是時候將我自己的邏輯放入應用程序中了。 這就是令人沮喪的地方。
Swapping the View element with a text input was easy, and so was adding a button with an onClick action. But trying to have a data set to save the user input, was down right mind boggling. I made a variable which was an array in the state object and tried various ways to update it when the user finished entering his/her own input. I have searched high and low and implemented various solutions to allow my application to save data to the array, but to no avail. The documentation I did find was sparse and it wasn’t really helpful. Not to mention the plethora of compilation errors I was having, which were not that instructive into what was wrong with my code. After a while, it became quite annoying seeing that red screen repeatedly.
用文本輸入交換View元素很容易,添加帶有onClick動作的按鈕也很容易。 但是試圖擁有一個數據集來保存用戶輸入,卻是令人費解的。 我在狀態對象中創建了一個變量,該變量是一個數組,并在用戶輸入完自己的輸入后嘗試了各種方法對其進行更新。 我搜索了很多內容,并實施了各種解決方案,以使我的應用程序可以將數據保存到陣列,但無濟于事。 我確實發現的文檔很少,而且并沒有真正的幫助。 更不用說我遇到的過多編譯錯誤,這些錯誤對于我的代碼出了什么問題沒有啟發性。 一段時間后,反復看到紅色屏幕變得很煩人。
飄飄 (Fluttering Away)
Being flustered and ashamed I couldn’t make the simplest of applications using React, and following the announcement of Flutter, I thought I’d take a crack building the same application. You know what they say, change of place - change of luck.
由于感到慌亂和羞愧,我無法使用React使最簡單的應用程序變得簡單,在Flutter發布之后,我認為我會努力構建相同的應用程序。 你知道他們在說什么,地點的改變-運氣的改變。
Setup was a breeze and offered the same quick experience React afforded and I was ready to start developing in no time. Downloading the Flutter SDK and installing the plugin were part of just a few simple steps to start developing in Flutter.
設置輕而易舉,并提供了React提供的相同的快速體驗,我準備立即開始開發。 下載Flutter SDK和安裝插件只是開始在Flutter中進行開發的幾個簡單步驟的一部分。
Next came the task of looking at the code. How can I put it into words? Not what I was expecting. You have different components in a long and winding hierarchy, which at times, can be difficult to keep track of. Apart from that, you have widgets and columns and rows and you need to figure out where everything fits in together. By now, you are thinking I am supposed to tell you why I like Flutter. As most things are, they have their strengths and weaknesses. And after going over the things I think are irritating, I can relish in what I found endearing.
接下來是查看代碼的任務。 我該如何用語言表達呢? 不是我所期望的。 您在冗長而曲折的層次結構中具有不同的組件,有時可能難以跟蹤。 除此之外,您還具有小部件,列和行,并且需要弄清楚所有內容在哪里組合在一起。 現在,您認為我應該告訴您為什么我喜歡Flutter。 就大多數情況而言,它們各有優缺點。 在審閱了我認為令人討厭的事物之后,我可以品嘗一下我發現的可愛事物。
For starters, Flutter is heavily documented. Every time I had to look up for something, I could easily find it in the documentation. More so, there are so many real life examples of various applications out there, that you are bound to find one similar to something that you are trying to make.
對于初學者來說,Flutter有大量記錄 。 每次需要查找時,都可以在文檔中輕松找到它。 更重要的是,這里有很多關于各種應用程序的真實示例,您必然會找到與您嘗試制作的類似的應用程序。
After tinkering with the starter code, you start to get a hang of the hierarchy, and how views are displayed, that you come to understand the weird intricacies of it all. It was also a blast to realize that making a component behave a certain way was as easy as adding another characteristic to the widget.
修改了入門代碼后,您開始了解層次結構,并了解視圖的顯示方式,從而了解所有這些內容的怪異復雜性。 意識到使組件以某種特定方式工作就像向小部件添加另一個特性一樣容易,這也是一個爆炸。
And above all, I was already in a native setting. I was at home with Android Studio, understanding where everything goes and enjoying the luxuries and benefits of a familiar surrounding.
最重要的是, 我已經處于原生環境 。 我在Android Studio的家中,了解一切進展并享受熟悉的環境帶來的奢華和好處。
Compared to the time I spent trying to develop my application in React, the time I spent in Flutter was a fraction of that. Plus, even if what you are trying to do doesn’t always work, you get the sense of eventual progress and you are encouraged to look at things in more detail inside the documentation.
比起我花了試圖開發我的申請做出React的時候,我在撲花的時間的一小部分。 另外,即使您嘗試執行的操作并非總是有效,您仍會感覺到最終的進展,因此鼓勵您仔細閱讀文檔中的內容。
Angry 😠? Upset 🙍? Exhilarated 😂? Jubilant? 🙌 Let me know what you think.
生氣😠? 心煩🙍? 😂? 喜慶? 🙌讓我知道你的想法。
翻譯自: https://www.freecodecamp.org/news/flutter-vs-react-native-and-why-i-think-flutter-is-best-for-mobile-app-development/
總結
以上是生活随笔為你收集整理的Flutter VS React Native –为什么我认为Flutter最适合移动应用程序开发的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做梦梦到丝瓜什么意思
- 下一篇: 儿子属蛇我梦到蛇好不好