Flutter vs React for Web

Flutter vs React for Web

React and Flutter both are solid technologies backed by some of the largest companies in the world. Both have wide adoption for different purposes though React arguably is more popular for websites and Flutter more popular for building native apps. In this article though we are going to discuss their suitability specifically for web applications and websites that run in browsers.

Table of contents

  1. What is Flutter ?
  2. What is React ?
  3. Advantages of Flutter compared to React
  4. Disadvantage of Flutter compared to React
  5. Advantages of React for web compared to Flutter
  6. Disadvantages of React compared to Flutter
  7. When should I prefer Flutter over React for web development ?
  8. When should I prefer React over Flutter for web development ?
  9. Conclusion

What is Flutter ?

Flutter if you do not know is a framework for building cross platform applications. It uses Dart programming language to write code.

Flutter and Dart are open source and backed by Google. Initially, Google developed Dart with an aim to replace Javascript. However those plans did not succeed and instead Google repurposed it to power Flutter.

Dart itself is a very well designed modern language that supports lot of interesting features such as async methods, null safety, ahead of time compilation, type inference and so on.

Flutter is designed from ground up to be multi platform however over time has found more takers who use it to build iOS and Android apps with a single codebase.

Flutter is a fullfledged framework which means it comes with a huge availabulity of components and libraries which are first class citizens of the framework and you do not have to rely very much on third party libraries to fill the gaps.

Given this, the patterns to design a flutter app remain remarkably well defined and you often don't have to worry about third party libraries to solve any major feature gap.

What is React ?

React is a library built by Meta. It was primarily built as a javascript library to build reusable components that can maintain state, mix markup and javacript seamlessly and assist in separation of concerns between different UI components.

React became extremely popular library over time and was adopted by many other companies. With time there was a huge ecosystem of third party libraries and frameworks using react.

Unlike Flutter which is a full fledged framework, React is just a library which means React needs to be used with other components if you want a full web application. Examples of such other frameworks are NextJs, MaterialUI for UI components.

React primarily uses a programming language called JSX and there is a typescript version of it called TSX which is gaining traction. But it is common to have multiple languages mixed in a react codebase.

Over time react native was built to provide React like programming paradigm to create native apps for iOS and Android. While React native is also very popular arguably it is less popular than Flutter.

Advantages of Flutter compared to React

Flutter has many advantages but most of them come from the fact that multi platform support is a first class feature in this framework.

  • Build Web, Android and iOS apps with the same codebase.
  • Since Flutter is a framework it comes with nearly all libraries you need to build a full functioning app.
  • Huge community and active development.
  • Several large open source softwares built using Flutter for your reference.
  • All the tooling to compile, build, deploy comes with Flutter.
  • All the UI components you will need are part of the framework.
  • Dart is a very powerful and modern language to power Flutter.
  • Whender rendered as Canvas app, flutter web app can do animations and render complex UI components which are extremely hard to do in normal HTML apps.
  • Dart language does not have reflection. Not having reflecting is an advantage because of Dart's feature called tree shaking. Dart can know at build time which included libraries are not need ever and simply strip them off from the build.

Disadvantage of Flutter compared to React

Flutter is a full framework and most of its disadvantages comes of this fact.

  • Flutter is unsuitable for webapps that rely on SEO or have stronger accessibility needs.
  • Flutter web apps can be rendered as HTML or Canvas, if you chose Canvas then your website isn't an HTML site anymore. SEO, Web vitals etc. would fail there.
  • Flutter is geared towards "app experience" and not a website hence it is unsuitable technology is you are building a website and not an app.
  • If you find that exisisting Flutter libraries are not sufficient and you need something else, you will have to put lot of efforts into building it in a cross-platform way.
  • The third party plugins are often not meant for all platforms.
  • The entire development paradigm is different and hence your existint experience with other technologies is useless.

Advantages of React for web compared to Flutter

React is already a big winner in the world of web frontends but I will still provide the advantages.

  • Powerful library already widely used.
  • Has large active community and ever expanding third party libraries.
  • Uses an easy to learn and already well known language like Javascript or Typescript.
  • Built for web platform first.
  • You can use React with other libraries or legacy codebase without much issues.
  • Pages can be built with performance in mind.
  • It is possible to do good SEO management for React apps.

Disadvantages of React compared to Flutter

  • Thinking in react might be slightly hard to learn for someone coming from pure HTML background.
  • React performance management is hard if you are inexperienced.
  • React is not a framework, you need to chose an appropriate server and UI framework to use React. Though there are many excellent options available.
  • Tooling is all over the place. You have wide variety of tools that you have to mix and match to build and compile.
  • React code results into Javascript and HTML and suffers from their disadvantages like cross browser issues.

When should I prefer Flutter over React for web development ?

Flutter is a good option when you are building an app and you do not care about search engine indexing, but you care about running it on multiple platforms like Android and iOS. Flutter can also support generating desktop apps for Windows, Linux and MacOS.

There is no reason to use Flutter for web apps if you do not have any need to create cross platform support or if you want the app to be SEO compliant.

Overall, I think Flutter is a good choice only in extreme usecases and in general should be avoided.

When should I prefer React over Flutter for web development ?

In nearly all cases. React is just a library on top of existing web technologies this makes it much better choice for web apps. It is also incredibly popular and has been used by millions of websites and web apps already. It is always better to use a proven technology.

Conclusion

Most comparison articles often end up in ambiguous answers about who is the winner. However when it comes to web, React is a clear winner against Flutter. Not only flutter has a long way to go, it is unlikely it will ever be a better option for web apps because at a fundamental level it is built for cross platform apps and not really open web.

Please email us on contact@frontendeng.dev if you want to cover any specific topic or have any other suggestions.