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.
這不是您可能會想到的文章類型。 我不會列出每個框架的優(yōu)缺點,也不會對性能進(jìn)行比較分析。
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.
在過去的幾周中,我竭盡全力嘗試使用這兩個框架創(chuàng)建簡單的功能性應(yīng)用程序。 本文的標(biāo)題是我從實驗中得出的結(jié)論。
?? 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?免責(zé)聲明:我絕不說框架A比框架B更好,而且我也沒有給我任何意見。 這只是一篇基于我個人經(jīng)驗的文章,僅此而已。
一些背景 (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有一定的了解,并且對本機(jī)開發(fā)有相當(dāng)?shù)牧私狻?由于這兩個框架相對較新,并且提供了相同類型的開發(fā)經(jīng)驗,所以我認(rèn)為我將嘗試嘗試一下整個過程。 當(dāng)然,我對這兩者的整體邏輯并不十分精通,并且我還沒有完全理解React中的狀態(tài)組件或Dart中的組件層次結(jié)構(gòu)。 話雖如此,我著手在兩個平臺上創(chuàng)建一個基本應(yīng)用程序。 申請的前提? 接受用戶輸入并按一下按鈕的用戶將以某種列表顯示用戶輸入,用戶可以在屏幕上滾動瀏覽。
我的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來處理應(yīng)用程序。 設(shè)置項目非常簡單。 您所要做的就是按照《 入門指南》文檔中的說明進(jìn)行操作。 我安裝了Expo,并在幾分鐘之內(nèi)將我的應(yīng)用程序加載到手機(jī)上。 我非常感謝Expo應(yīng)用程序的QR碼掃描器在屏幕上識別代碼的速度。 Expo在計算機(jī)上的界面也非常簡單。 您可以查看應(yīng)用程序的狀態(tài)(正在構(gòu)建或正在失敗),啟動Android / iOS模擬器等。 現(xiàn)在是時候?qū)⑽易约旱倪壿嫹湃霊?yīng)用程序中了。 這就是令人沮喪的地方。
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動作的按鈕也很容易。 但是試圖擁有一個數(shù)據(jù)集來保存用戶輸入,卻是令人費解的。 我在狀態(tài)對象中創(chuàng)建了一個變量,該變量是一個數(shù)組,并在用戶輸入完自己的輸入后嘗試了各種方法對其進(jìn)行更新。 我搜索了很多內(nèi)容,并實施了各種解決方案,以使我的應(yīng)用程序可以將數(shù)據(jù)保存到陣列,但無濟(jì)于事。 我確實發(fā)現(xiàn)的文檔很少,而且并沒有真正的幫助。 更不用說我遇到的過多編譯錯誤,這些錯誤對于我的代碼出了什么問題沒有啟發(fā)性。 一段時間后,反復(fù)看到紅色屏幕變得很煩人。
飄飄 (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使最簡單的應(yīng)用程序變得簡單,在Flutter發(fā)布之后,我認(rèn)為我會努力構(gòu)建相同的應(yīng)用程序。 你知道他們在說什么,地點的改變-運氣的改變。
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.
設(shè)置輕而易舉,并提供了React提供的相同的快速體驗,我準(zhǔn)備立即開始開發(fā)。 下載Flutter SDK和安裝插件只是開始在Flutter中進(jìn)行開發(fā)的幾個簡單步驟的一部分。
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.
接下來是查看代碼的任務(wù)。 我該如何用語言表達(dá)呢? 不是我所期望的。 您在冗長而曲折的層次結(jié)構(gòu)中具有不同的組件,有時可能難以跟蹤。 除此之外,您還具有小部件,列和行,并且需要弄清楚所有內(nèi)容在哪里組合在一起。 現(xiàn)在,您認(rèn)為我應(yīng)該告訴您為什么我喜歡Flutter。 就大多數(shù)情況而言,它們各有優(yōu)缺點。 在審閱了我認(rèn)為令人討厭的事物之后,我可以品嘗一下我發(fā)現(xiàn)的可愛事物。
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.
對于初學(xué)者來說,Flutter有大量記錄 。 每次需要查找時,都可以在文檔中輕松找到它。 更重要的是,這里有很多關(guān)于各種應(yīng)用程序的真實示例,您必然會找到與您嘗試制作的類似的應(yīng)用程序。
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.
修改了入門代碼后,您開始了解層次結(jié)構(gòu),并了解視圖的顯示方式,從而了解所有這些內(nèi)容的怪異復(fù)雜性。 意識到使組件以某種特定方式工作就像向小部件添加另一個特性一樣容易,這也是一個爆炸。
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.
最重要的是, 我已經(jīng)處于原生環(huán)境 。 我在Android Studio的家中,了解一切進(jìn)展并享受熟悉的環(huán)境帶來的奢華和好處。
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.
比起我花了試圖開發(fā)我的申請做出React的時候,我在撲花的時間的一小部分。 另外,即使您嘗試執(zhí)行的操作并非總是有效,您仍會感覺到最終的進(jìn)展,因此鼓勵您仔細(xì)閱讀文檔中的內(nèi)容。
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/
總結(jié)
以上是生活随笔為你收集整理的Flutter VS React Native –为什么我认为Flutter最适合移动应用程序开发的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: 做梦梦到丝瓜什么意思
- 下一篇: caesar加密_如何编写Caesar密