This document provides an overview of reactivity in modern frontend frameworks. It begins with definitions of reactive programming and discusses how frameworks like Angular, React, Vue, and Svelte implement reactivity. Angular uses Zone.js to trigger change detection when asynchronous events occur. React uses virtual DOM diffing to re-render on state changes. Vue enables fine-grained reactivity through reactive proxies. Svelte generates reactivity code at compile time to efficiently update the DOM. Overall, the document gives a high-level introduction to the different approaches to reactivity used across popular frameworks.
The document discusses reactivity in modern frontend frameworks like Angular, React, and Vue. It begins with an introduction to reactive programming concepts. It then provides an overview of the baseline reactivity mechanisms in Angular using Zone.js change detection, and in React using function components and state updates. Alternative reactivity options in Angular like OnPush change detection and observables are presented. The document also covers reactive state management in Vue using reactive proxies and computed properties. Code examples are provided to demonstrate reactivity in each framework.
1) The document discusses reactivity in modern frontend frameworks like Angular, React, and Vue.
2) It explains the different approaches to reactivity including Angular's use of Zone.js for change detection, React's functional components approach, and Vue's reactive state.
3) The document also covers alternatives within frameworks like OnPush change detection in Angular and using observables, as well as design patterns like separating state from components.
React gsg presentation with ryan jung & elias malikLama K Banna
React is a client-side JavaScript library for building user interfaces that is made and open-sourced by Facebook. It uses a virtual DOM for fast rendering and reusable components to build up the UI. Components can have their own state that causes re-rendering when updated. Events are handled through callbacks. JSX allows writing HTML-like code mixed with JavaScript.
Managing state across complex apps with many interacting components can be challenging. Flux and Redux address this with a single source of truth store and reducer functions that update state immutably in response to actions. Side effects like API calls require middleware like thunks, sagas, or API-specific middleware to isolate impure logic from pure reducers.
In this presentation, Prashant Sharma of Valuebound has talked about ReactJS - a JavaScript library for building user interfaces. Check out the agendas to know what is there for you.
----------------------------------------------------------
Get Socialistic
Our website: http://valuebound.com/
LinkedIn: http://bit.ly/2eKgdux
Facebook: https://www.facebook.com/valuebound/
Twitter: http://bit.ly/2gFPTi8
This document provides an overview of React Native, Redux, and ES6 concepts. It begins with an introduction to React Native fundamentals like components, props vs state, and styling. It then covers Redux terminology such as actions, reducers, and middleware. Finally, it discusses ES6 features like arrow functions, destructuring, and template literals. Code examples and links to documentation are provided throughout for illustrating key concepts.
This document provides an overview of React, a JavaScript library for building user interfaces. It discusses what React is, why it is useful, when to use it, and its key features and components. React allows building of reusable UI components in a declarative way. It uses a virtual DOM for better performance and can render on both client and server sides. Key advantages include high performance with large data changes, reusability, and ease of building large, complex UIs. The document also provides examples of building a simple React app in steps and references for further information.
The document discusses reactivity in modern frontend frameworks like Angular, React, and Vue. It begins with an introduction to reactive programming concepts. It then provides an overview of the baseline reactivity mechanisms in Angular using Zone.js change detection, and in React using function components and state updates. Alternative reactivity options in Angular like OnPush change detection and observables are presented. The document also covers reactive state management in Vue using reactive proxies and computed properties. Code examples are provided to demonstrate reactivity in each framework.
1) The document discusses reactivity in modern frontend frameworks like Angular, React, and Vue.
2) It explains the different approaches to reactivity including Angular's use of Zone.js for change detection, React's functional components approach, and Vue's reactive state.
3) The document also covers alternatives within frameworks like OnPush change detection in Angular and using observables, as well as design patterns like separating state from components.
React gsg presentation with ryan jung & elias malikLama K Banna
React is a client-side JavaScript library for building user interfaces that is made and open-sourced by Facebook. It uses a virtual DOM for fast rendering and reusable components to build up the UI. Components can have their own state that causes re-rendering when updated. Events are handled through callbacks. JSX allows writing HTML-like code mixed with JavaScript.
Managing state across complex apps with many interacting components can be challenging. Flux and Redux address this with a single source of truth store and reducer functions that update state immutably in response to actions. Side effects like API calls require middleware like thunks, sagas, or API-specific middleware to isolate impure logic from pure reducers.
In this presentation, Prashant Sharma of Valuebound has talked about ReactJS - a JavaScript library for building user interfaces. Check out the agendas to know what is there for you.
----------------------------------------------------------
Get Socialistic
Our website: http://valuebound.com/
LinkedIn: http://bit.ly/2eKgdux
Facebook: https://www.facebook.com/valuebound/
Twitter: http://bit.ly/2gFPTi8
This document provides an overview of React Native, Redux, and ES6 concepts. It begins with an introduction to React Native fundamentals like components, props vs state, and styling. It then covers Redux terminology such as actions, reducers, and middleware. Finally, it discusses ES6 features like arrow functions, destructuring, and template literals. Code examples and links to documentation are provided throughout for illustrating key concepts.
This document provides an overview of React, a JavaScript library for building user interfaces. It discusses what React is, why it is useful, when to use it, and its key features and components. React allows building of reusable UI components in a declarative way. It uses a virtual DOM for better performance and can render on both client and server sides. Key advantages include high performance with large data changes, reusability, and ease of building large, complex UIs. The document also provides examples of building a simple React app in steps and references for further information.
This document provides an overview of AngularJS, including its core features and concepts. It discusses how AngularJS is a client-side JavaScript framework that uses MVC architecture. Key points covered include two-way data binding, templates, dependency injection, modules, controllers, views, models, scopes, filters, services, and directives. Custom directives and their creation are demonstrated. The document aims to give attendees an introduction to AngularJS and its basic building blocks.
This document discusses 7 challenges of using Redux including: 1) Async programming and cancelling promises, 2) Preventing DOM mutations from libraries, 3) Working with the URL bar in single page applications, 4) Piggybacking on componentDidMount to generate data, 5) Using imperative programming patterns rather than functional patterns, 6) Mental overhead of action creators and reducers, and 7) Determining if reactive streams from Redux Saga are needed. The author provides recommendations for addressing each challenge through further research and adopting functional programming principles.
The document discusses architectural design patterns MVC, MVP, and MVVM. It explains that MVC separates an application into three components - the model, the view, and the controller. MVP adds a presenter layer between the model and view to avoid direct communication. MVVM uses data binding between the view and view model layers, allowing two-way communication to automatically update the view when data changes. While any pattern can be used, the author recommends MVP with data binding to reduce code and prevent mistakes.
The document discusses the Model View Controller (MVC) framework. It describes MVC's three components - the model, view, and controller. The key features of MVC like scaffolding, authentication, and testability are covered. Examples of MVC architecture, workflow, views, and action results are provided. The advantages of separation of concerns and ease of maintenance are contrasted with disadvantages like complexity and lack of design previews.
This document discusses React.js and its use for frontend development. It covers the key features and advantages of React, how it works, its architecture including components and the virtual DOM, comparisons to other frameworks like Angular, and examples of companies that use React like Facebook and Netflix. The summary is:
React.js is a popular library for building user interfaces that uses reusable components and a virtual DOM for improved performance. It has advantages over frameworks like Angular in being easier to learn and use due to its simpler architecture and unidirectional data flow. Major companies like Facebook use React for significant parts of their applications, demonstrating its widespread adoption.
As applications grow in complexity, web developers and front-end developers all suffer the hassle of building and maintaining complex web applications; managing and maintaining consistency of application state. This presentation goes through what's special about React and Redux.
This was part of JOSA TechTalks project within Jordan Open Source Association, presented by Ali Sa'o and Omar Abdelhafith.
My React TechTalk with Jordan open source association on Sep 13-2017 @Zinc , KHBP.
Session source code :
https://github.com/ali-sao/Better-web-apps-with-react-redux-.git
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It uses virtual DOM which improves performance and can render on both client and server. React encourages a component-based approach where UI is broken into independent reusable pieces that accept external data through properties. Components manage their own state which allows the UI to update over time in response to user input. This makes React code more predictable and easier to debug than traditional two-way data binding.
AngularJS is an open source JavaScript framework for building dynamic web applications. It enhances HTML with custom directives and bindings to enrich client-side web applications with reusable components. Key features include two-way data binding, reusable components, support for MVC/MVVM design patterns, end-to-end testing, cross-browser compatibility, and services. AngularJS allows developers to organize applications into modules and controllers to keep code clean and reusable.
React is a JavaScript library for building fast and interactive user interfaces for web and mobile applications. It uses a virtual DOM that makes web apps fast by only updating changed objects in the real DOM. React breaks complex UIs into reusable components that allow for unidirectional data flow and simultaneous development. Key features include JSX, the virtual DOM, performance, and extensions for server-side rendering and mobile apps.
From Backbone to Ember and Back(bone) Againjonknapp
As a software consultant, I get to see a lot of interesting code. In this particular instance a client was in the process of transforming their web application to a rich, interactive interface with the help of another company.
The project kicked off using Backbone and things were great. Until they were not great. Pages starting getting more and more involved and blame started being thrown at the technology choice.
A move to Ember.js ensued and the app was rewritten. But architecturally bad decisions don't hide long, and soon the rewrite was preforming even worse. That's when I stepped in, with the help of another consultant, to solve the performance issues once and for all. Our solution used Backbone.js and it was fast. This is that journey.
My perspective on MVP and architecture discussionsPaul Blundell
Talk about what MVP means to different people and how using MVP doesn't even matter. It's about the discussion.
I've hacked an app together with MVP, I want to show my findings and opinions about the most over defined term for a pattern ever.
React JS Components & Its Importance.docxReact Masters
Explore the importance of React components, Virtual DOM, JSX, State, Props, and more. Unlock the secrets to optimizing React performance and gain insights into React Native for mobile app development.
In the context of React, “components” refer to reusable, self-contained building blocks that encapsulate a part of a user interface (UI) and its logic. React is a JavaScript library for building user interfaces, and its component-based architecture makes it easier to manage and scale complex UIs. React components can be thought of as custom, reusable HTML elements with associated JavaScript logic. React components enable a modular and maintainable approach to building UIs, as they can be composed and reused throughout the application. The component-based structure of React promotes a clear separation of concerns and facilitates the development and maintenance of large-scale applications.
At Lia Infraservice we create Dynamic Websites. Become a front-end React JS developer and be a part of our tech-savvy Web App Development Company in Chennai.
AngularJS is a structural framework for dynamic web apps.This presentation talks about Angular js Basics (MV* architecture), Two Way Data-Binding, Templates, Dependency Injection etc...
Angular 2 is a rewrite of AngularJS for modern web development. It improves on AngularJS by being faster, easier to use and learn, and built on proven best practices. Some key differences include components replacing controllers, unidirectional data flow instead of two-way binding, and type-based dependency injection rather than naming. While the core concepts remain similar, the implementation in Angular 2 is cleaner. However, setting up a full Angular project can still be complicated due to dependencies on build tools and module bundling.
The curious Life of JavaScript - Talk at SI-SE 2015jbandi
My talk about the life of JavaScript, from birth to today.
I went trough the demos and code examples very quickly, rather as a teaser to show how modern JavaScript development might look.
If you are interested in a deep dive into the topic of modern JavaScript development, HTML5, ES6, AngularJS, React, Gulp, Grunt etc, please consider my courses: http://www.ivorycode.com/#schulung
This document provides an overview of AngularJS, including its core features and concepts. It discusses how AngularJS is a client-side JavaScript framework that uses MVC architecture. Key points covered include two-way data binding, templates, dependency injection, modules, controllers, views, models, scopes, filters, services, and directives. Custom directives and their creation are demonstrated. The document aims to give attendees an introduction to AngularJS and its basic building blocks.
This document discusses 7 challenges of using Redux including: 1) Async programming and cancelling promises, 2) Preventing DOM mutations from libraries, 3) Working with the URL bar in single page applications, 4) Piggybacking on componentDidMount to generate data, 5) Using imperative programming patterns rather than functional patterns, 6) Mental overhead of action creators and reducers, and 7) Determining if reactive streams from Redux Saga are needed. The author provides recommendations for addressing each challenge through further research and adopting functional programming principles.
The document discusses architectural design patterns MVC, MVP, and MVVM. It explains that MVC separates an application into three components - the model, the view, and the controller. MVP adds a presenter layer between the model and view to avoid direct communication. MVVM uses data binding between the view and view model layers, allowing two-way communication to automatically update the view when data changes. While any pattern can be used, the author recommends MVP with data binding to reduce code and prevent mistakes.
The document discusses the Model View Controller (MVC) framework. It describes MVC's three components - the model, view, and controller. The key features of MVC like scaffolding, authentication, and testability are covered. Examples of MVC architecture, workflow, views, and action results are provided. The advantages of separation of concerns and ease of maintenance are contrasted with disadvantages like complexity and lack of design previews.
This document discusses React.js and its use for frontend development. It covers the key features and advantages of React, how it works, its architecture including components and the virtual DOM, comparisons to other frameworks like Angular, and examples of companies that use React like Facebook and Netflix. The summary is:
React.js is a popular library for building user interfaces that uses reusable components and a virtual DOM for improved performance. It has advantages over frameworks like Angular in being easier to learn and use due to its simpler architecture and unidirectional data flow. Major companies like Facebook use React for significant parts of their applications, demonstrating its widespread adoption.
As applications grow in complexity, web developers and front-end developers all suffer the hassle of building and maintaining complex web applications; managing and maintaining consistency of application state. This presentation goes through what's special about React and Redux.
This was part of JOSA TechTalks project within Jordan Open Source Association, presented by Ali Sa'o and Omar Abdelhafith.
My React TechTalk with Jordan open source association on Sep 13-2017 @Zinc , KHBP.
Session source code :
https://github.com/ali-sao/Better-web-apps-with-react-redux-.git
React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It uses virtual DOM which improves performance and can render on both client and server. React encourages a component-based approach where UI is broken into independent reusable pieces that accept external data through properties. Components manage their own state which allows the UI to update over time in response to user input. This makes React code more predictable and easier to debug than traditional two-way data binding.
AngularJS is an open source JavaScript framework for building dynamic web applications. It enhances HTML with custom directives and bindings to enrich client-side web applications with reusable components. Key features include two-way data binding, reusable components, support for MVC/MVVM design patterns, end-to-end testing, cross-browser compatibility, and services. AngularJS allows developers to organize applications into modules and controllers to keep code clean and reusable.
React is a JavaScript library for building fast and interactive user interfaces for web and mobile applications. It uses a virtual DOM that makes web apps fast by only updating changed objects in the real DOM. React breaks complex UIs into reusable components that allow for unidirectional data flow and simultaneous development. Key features include JSX, the virtual DOM, performance, and extensions for server-side rendering and mobile apps.
From Backbone to Ember and Back(bone) Againjonknapp
As a software consultant, I get to see a lot of interesting code. In this particular instance a client was in the process of transforming their web application to a rich, interactive interface with the help of another company.
The project kicked off using Backbone and things were great. Until they were not great. Pages starting getting more and more involved and blame started being thrown at the technology choice.
A move to Ember.js ensued and the app was rewritten. But architecturally bad decisions don't hide long, and soon the rewrite was preforming even worse. That's when I stepped in, with the help of another consultant, to solve the performance issues once and for all. Our solution used Backbone.js and it was fast. This is that journey.
My perspective on MVP and architecture discussionsPaul Blundell
Talk about what MVP means to different people and how using MVP doesn't even matter. It's about the discussion.
I've hacked an app together with MVP, I want to show my findings and opinions about the most over defined term for a pattern ever.
React JS Components & Its Importance.docxReact Masters
Explore the importance of React components, Virtual DOM, JSX, State, Props, and more. Unlock the secrets to optimizing React performance and gain insights into React Native for mobile app development.
In the context of React, “components” refer to reusable, self-contained building blocks that encapsulate a part of a user interface (UI) and its logic. React is a JavaScript library for building user interfaces, and its component-based architecture makes it easier to manage and scale complex UIs. React components can be thought of as custom, reusable HTML elements with associated JavaScript logic. React components enable a modular and maintainable approach to building UIs, as they can be composed and reused throughout the application. The component-based structure of React promotes a clear separation of concerns and facilitates the development and maintenance of large-scale applications.
At Lia Infraservice we create Dynamic Websites. Become a front-end React JS developer and be a part of our tech-savvy Web App Development Company in Chennai.
AngularJS is a structural framework for dynamic web apps.This presentation talks about Angular js Basics (MV* architecture), Two Way Data-Binding, Templates, Dependency Injection etc...
Angular 2 is a rewrite of AngularJS for modern web development. It improves on AngularJS by being faster, easier to use and learn, and built on proven best practices. Some key differences include components replacing controllers, unidirectional data flow instead of two-way binding, and type-based dependency injection rather than naming. While the core concepts remain similar, the implementation in Angular 2 is cleaner. However, setting up a full Angular project can still be complicated due to dependencies on build tools and module bundling.
The curious Life of JavaScript - Talk at SI-SE 2015jbandi
My talk about the life of JavaScript, from birth to today.
I went trough the demos and code examples very quickly, rather as a teaser to show how modern JavaScript development might look.
If you are interested in a deep dive into the topic of modern JavaScript development, HTML5, ES6, AngularJS, React, Gulp, Grunt etc, please consider my courses: http://www.ivorycode.com/#schulung
The document summarizes the author's journey learning JavaScript and the evolution of JavaScript as a serious programming language. It discusses the author's initial denial and fear of JavaScript, but then growing curiosity. It outlines quotes from early critics of JavaScript becoming more positive over time. It also introduces concepts like single page applications, Nashorn (JavaScript runtime on the JVM), and Project Avatar (Oracle's effort to bring Node.js capabilities to the JVM).
There is something about JavaScript - Choose Forum 2014jbandi
JavaScript has evolved from being seen as a joke to becoming a serious programming language used to build large web applications. It started as a scripting language for web browsers but is now used widely on both the client-side and server-side. The JavaScript ecosystem is very active with many libraries, frameworks, and tools available to help developers build and test applications.
Professional JavaScript Development (An Introduction for Java Developers)jbandi
This document provides an introduction to JavaScript development for Java developers. It discusses the evolution of JavaScript from a joke language to a primary development platform in browsers. It outlines the key differences between JavaScript and Java programming models and libraries/frameworks commonly used in JavaScript like jQuery, AngularJS, and tooling like Bower. It proposes a two day bootcamp agenda covering JavaScript language features, patterns, tooling and frameworks to teach Java developers JavaScript and how to integrate it with Java backends.
vert.x - asynchronous event-driven web applications on the JVMjbandi
This document discusses asynchronous event-driven web applications on the Java Virtual Machine (JVM). It provides an overview of the Vert.x platform, which is a tool for building reactive applications on the JVM. The document outlines how Vert.x addresses the "C10k problem" by using an asynchronous and non-blocking architecture based on an event loop. It demonstrates Vert.x's capabilities through examples and compares it to other technologies like Node.js. The key aspects covered are Vert.x's core APIs, scaling approach using message passing, and support for distributed applications through its event bus.
The document discusses whether JavaScript can be elegant. It notes that new JavaScript frameworks aim to simplify complex browser-side programming. It also includes quotes from different people discussing how enterprises view JavaScript developers and whether JavaScript needs to be replaced.
NDC 2011 - Building .NET Applications with BDDjbandi
TechTalk is a software development company that has been using Behavior-Driven Development (BDD) for several years. They created the SpecFlow tool to help implement BDD in their projects. This document discusses TechTalk's BDD process, including capturing requirements as executable specifications, organizing features and steps, using automation to improve feedback, and maintaining living documentation alongside source code.
This document provides an overview of SpecFlow, a behavior-driven development (BDD) tool for .NET. It introduces SpecFlow, discusses BDD and how SpecFlow fits into agile practices like test-driven development (TDD) and acceptance test-driven development (ATDD). The document outlines TechTalk, the company behind SpecFlow, demonstrates SpecFlow functionality, and discusses integrations with tools like Visual Studio and build servers. It also previews upcoming SpecFlow sessions at NDC 2011 and takes questions from the audience. The summary concludes in 3 sentences or less.
UI5con 2024 - Boost Your Development Experience with UI5 Tooling ExtensionsPeter Muessig
The UI5 tooling is the development and build tooling of UI5. It is built in a modular and extensible way so that it can be easily extended by your needs. This session will showcase various tooling extensions which can boost your development experience by far so that you can really work offline, transpile your code in your project to use even newer versions of EcmaScript (than 2022 which is supported right now by the UI5 tooling), consume any npm package of your choice in your project, using different kind of proxies, and even stitching UI5 projects during development together to mimic your target environment.
Top Benefits of Using Salesforce Healthcare CRM for Patient Management.pdfVALiNTRY360
Salesforce Healthcare CRM, implemented by VALiNTRY360, revolutionizes patient management by enhancing patient engagement, streamlining administrative processes, and improving care coordination. Its advanced analytics, robust security, and seamless integration with telehealth services ensure that healthcare providers can deliver personalized, efficient, and secure patient care. By automating routine tasks and providing actionable insights, Salesforce Healthcare CRM enables healthcare providers to focus on delivering high-quality care, leading to better patient outcomes and higher satisfaction. VALiNTRY360's expertise ensures a tailored solution that meets the unique needs of any healthcare practice, from small clinics to large hospital systems.
For more info visit us https://valintry360.com/solutions/health-life-sciences
E-Invoicing Implementation: A Step-by-Step Guide for Saudi Arabian CompaniesQuickdice ERP
Explore the seamless transition to e-invoicing with this comprehensive guide tailored for Saudi Arabian businesses. Navigate the process effortlessly with step-by-step instructions designed to streamline implementation and enhance efficiency.
UI5con 2024 - Keynote: Latest News about UI5 and it’s EcosystemPeter Muessig
Learn about the latest innovations in and around OpenUI5/SAPUI5: UI5 Tooling, UI5 linter, UI5 Web Components, Web Components Integration, UI5 2.x, UI5 GenAI.
Recording:
https://www.youtube.com/live/MSdGLG2zLy8?si=INxBHTqkwHhxV5Ta&t=0
What to do when you have a perfect model for your software but you are constrained by an imperfect business model?
This talk explores the challenges of bringing modelling rigour to the business and strategy levels, and talking to your non-technical counterparts in the process.
UI5con 2024 - Bring Your Own Design SystemPeter Muessig
How do you combine the OpenUI5/SAPUI5 programming model with a design system that makes its controls available as Web Components? Since OpenUI5/SAPUI5 1.120, the framework supports the integration of any Web Components. This makes it possible, for example, to natively embed own Web Components of your design system which are created with Stencil. The integration embeds the Web Components in a way that they can be used naturally in XMLViews, like with standard UI5 controls, and can be bound with data binding. Learn how you can also make use of the Web Components base class in OpenUI5/SAPUI5 to also integrate your Web Components and get inspired by the solution to generate a custom UI5 library providing the Web Components control wrappers for the native ones.
Project Management: The Role of Project Dashboards.pdfKarya Keeper
Project management is a crucial aspect of any organization, ensuring that projects are completed efficiently and effectively. One of the key tools used in project management is the project dashboard, which provides a comprehensive view of project progress and performance. In this article, we will explore the role of project dashboards in project management, highlighting their key features and benefits.
Hand Rolled Applicative User ValidationCode KataPhilip Schwarz
Could you use a simple piece of Scala validation code (granted, a very simplistic one too!) that you can rewrite, now and again, to refresh your basic understanding of Applicative operators <*>, <*, *>?
The goal is not to write perfect code showcasing validation, but rather, to provide a small, rough-and ready exercise to reinforce your muscle-memory.
Despite its grandiose-sounding title, this deck consists of just three slides showing the Scala 3 code to be rewritten whenever the details of the operators begin to fade away.
The code is my rough and ready translation of a Haskell user-validation program found in a book called Finding Success (and Failure) in Haskell - Fall in love with applicative functors.
Using Query Store in Azure PostgreSQL to Understand Query PerformanceGrant Fritchey
Microsoft has added an excellent new extension in PostgreSQL on their Azure Platform. This session, presented at Posette 2024, covers what Query Store is and the types of information you can get out of it.
1. From User Action to
Framework Reaction
Reactivity in modern Frontend Frameworks
2. Jonas Bandi
@jbandi
- Freelancer, in den letzten 8 Jahren vor allem in Projekten
im Spannungsfeld zwischen modernen Webentwicklung
und traditionellen Geschäftsanwendungen.
- Dozent an der Berner Fachhochschule seit 2007
- In-House Kurse & Beratungen zu Web-Technologien im
Enterprise: UBS, Post
fi
nance, Mobiliar,AXA, BIT, SBB, Elca,
Adnovum, BSI ...
JavaScript / Angular / React / Vue.js
Schulung / Beratung / Coaching / Reviews
jonas.bandi@ivorycode.com
3. Reactivity ?
"There are as many de
fi
nitions of
reactive programming as there are
reactive programmers."
4. Reactive Programming?
In computing, reactive programming is a declarative
programming paradigm concerned with data
streams and the propagation of change.
- Wikipedia
Reactive programming is programming with
asynchronous data streams.
-The introduction to Reactive Programming you've been missing
https://gist.github.com/staltz/868e7e9bc2a7b8c1f754
click$
.pipe(scan(count => count + 1, 0))
.subscribe(count => console.log(`Clicked ${count} times`));
reactive programming is a paradigm in which declarative code
is issued to construct asynchronous processing pipelines.
- De
fi
ning the term "reactive"
https://developer.ibm.com/articles/de
fi
ning-the-term-reactive/
5. "The essence of functional reactive
programming is to specify the
dynamic behavior of a value
completely at the time of declaration"
- Heinrich Apfelmus, via Michel Westrate
https://www.youtube.com/watch?v=AdNJ3fydeao
6.
7. Agenda
Reactivity - What are we talking about here?
• Code Example
• How does it work?
• Implications
• One Advantage
• One Problem
A glimpse into each framework.
A "feeling" how the framework works.
Int
ro
E
xp
lorat
ion
"Out of the Box"-Reactivity of
T
a
k
e
a
w
a
y
8. State of JavaScript Survey 2021:
https://2021.stateofjs.com/en-US/libraries/front-end-frameworks
18. UI (DOM)
Action
Reaction:
re-render
Ajax
Timeout
...
User
t
r
i
g
g
e
r
EvanYou - Reactivity in Frontend JavaScript Frameworks: https://www.youtube.com/watch?v=r4pNEdIt_l4
http://teropa.info/blog/2015/03/02/change-and-its-detection-in-javascript-frameworks.html
State (JavaScript)
The UI renders the state and "signals" events.
change
st
at
e
(asynchronous)
Reactivity in a SPA:The application reacts on
state changes and updates the UI.
State is Managed in JavaScript
19. Reactivity:What and Why?
Traditional
"DOM-centric"
applications
UI = state
Browsers have "built-in" reactivity: If the DOM is
changed, the UI is re-rendered.
UI = f(state)
With client-side
Single-Page-
Applications, the
state is represented
as JavaScript objects.
The UI that you can see and manipulate
on screen is the result of painting a
visual representation of data.
This is the Reactivity we are investigating:
How do frameworks deal with state changes over time?
The UI should (automatically) update when the state changes.
When to call?
Problem: the same state might be displayed at several places in the DOM.
25. Zone.js:
The "Magic" in Angular Change Detection
Zone.js is a JavaScript library provided by the Angular project that
patches many asynchronous browser APIs. Listeners can then be
triggered when these APIs are executed.
Angular relies on Zone.js to trigger automatic change detection.
Angular is running inside the NgZone (a zone created via
Zone.js).When async APIs are executed Angular gets noti
fi
ed
when the execution has
fi
nished and triggers change detection.
https://github.com/angular/zone.js/
https://medium.com/better-programming/zone-js-for-angular-devs-573d89bbb890
Patched APIs (examples): setTimeout, Promise, XMLHttpRequest, prompt
and DOM events.
More details: https://github.com/angular/angular/blob/master/packages/zone.js/STANDARD-APIS.md
26. Default Reactivity in Angular
UI = f(state) Triggered by Zone.js
"simulated reactivity"
setInterval(
1000);
Zone.js
Zone to Angular:
"Hey, there might be something going on …"
apply minimal
changes.
DOM
() => this.count++
State
count: 42
let's check
everything ...
increase
<div>42</div>
change
detection
"simulated reactivity"
29. Default Reactivity in Angular
Zone.js with Default Change Detection:
• is a form of simulated reactivity: the framework does
not react to changes but to events that might
potentially have caused changes
• is a form of transparent reactivity: It makes reactivity
an implicit characteristic of your program.
TheTaxonomy of Reactive Programming: https://vsavkin.com/the-taxonomy-of-reactive-programming-d40e2e23dee4
https://github.com/meteor/docs/blob/version-NEXT/long-form/tracker-manual.md
A common alternative in Angular is to model Reactivity
explicitly with RxJS, this is a form of explicit reactivity.
30. Default Angular Reactivity
Transparent Reactivity:
The programmer should be
able to use ideomatic
JavaScript, the Framework
does the rest.
Programming model based
on mutations.
Strength Weakness
Zone.js: Patching the browser is
problematic on many levels.
Brute-force approach of default
change detection is not optimal in
regard to performance.
Change Detection imposes
constraints / rules ...
- unidirectional data-
fl
ow
- avoid setter/getters?
- no native async/await
"Simulated Reactivity"
33. Function Components
function AppComponent(props) {
return (
<div>
<h1>{props.title}</h1>
<p>{props.message}</p>
</div>
);
}
data
Components are written as plain JavaScript functions.
UI
(DOM ... )
The function is called each time the UI is
rendered (i.e. with every data-change)
AVisual GuideTo React Mental Models:
https://obedparla.com/code/a-visual-guide-to-react-mental-models/
34. TheVirtual DOM
Components Virtual DOM Browser DOM
body
div
h1 div
button
input
<body>
<div>
<h1></h1>
<div>
<input/>
<button>
</button>
</div>
</div>
</body>
App
Title
Content
input
button
diff
patch
render
TheVirtual DOM also enables server-side rendering and
rendering to iOS/Android UIs.
In-Memory, implemented in JavaScript
reconciliation
https://reactjs.org/docs/reconciliation.html
if the state changes
components are
rendered completely
including all their
children
37. Reactivity in React
UI = f(state) triggered by
the programmer
setInterval(() =>
1000);
Programmer to React:
"Please change the state for me ... "
apply minimal changes.
DOM
setCount(count => count + 1),
State
count: 42
update the state
<div>42</div>
trigger re-rendering
virtual
DOM
40. React Reactivity
Functional Mindset:
- Rendering is a side-effect
of state changes.
- Components transform
state to ui.
Strength Weakness
"Render everything" approach is
wasteful.
State is managed by React: we
have to use the APIs and concepts
of React.
Programming model enforces
"immutable state management".
"Everything is rendered on every state change"
https://www.joshwcomeau.com/react/why-react-re-renders/
https://blog.isquaredsoftware.com/2020/05/blogged-answers-a-mostly-complete-guide-to-react-rendering-behavior/
43. The example is using the Composition API ofVue 3:
https://vuejs.org/api/reactivity-core.html
changing state
triggers re-rendering
"Naked" Reactive State inVue:
44. Reactivity inVue
UI = f (state ) triggered by
reactive state
setInterval(
() =>
1000);
apply minimal changes.
DOM
State (Vue proxy)
{ count: 42 }
<div>42</div>
trigger fine-grained
re-rendering
get/set count()
increase
A Hands-on Introduction to Fine-Grained Reactivity: https://dev.to/ryansolid/a-hands-on-introduction-to-
fi
ne-grained-reactivity-3ndf
Note: Some statemanagment libraries implement the same concept for other frameworks (MobX, Jotai, Signals ...)
++,
X X X
UI = f (state )
Y Y Y
UI = f (state )
Z Z Z
state.count
f
i
n
e
-
g
r
a
i
n
e
d
46. Vue Reactivity
"True Reactivity":The state
can be observed.
Fine-Grained Reactivity: only
runs the code that need to
be run.
Programming model
embraces mutability.
Strength Weakness
State is not "plain" JavaScript, which
comes with its own limitations.
"Reactive State"
https://dev.to/ryansolid/a-hands-on-introduction-to-
fi
ne-grained-reactivity-3ndf
48. At compile time. Svelte
generates code to
manipulate the D0M
at runtime.
49. Reactivity in Svelte
setInterval(
() => state.count++
1000);
apply minimal
changes.
DOM
<div>42</div>
UI = f (state )
triggered by
compile-time generated
code
X X X
UI = f (state )
Y Y Y
UI = f (state )
Z Z Z
f
i
n
e
-
g
r
a
i
n
e
d
setInterval(
() => {
state.count++;
$invalidate(state);
}
1000);
function $invalidate(args){
...
updateElement(el, newVal)
}
call
compile
generate
build-time run-time
svelte helper
functions
50. Compile-Time-Generated Reactivity
<script>
let name = 'Jonas';
let number = 0;
function update(e) {
name = 'Bandi';
number = 42;
}
</script>
<h1 on:click={update}>
Hello {name} {number}!
</h1>
import { SvelteComponent, append, detach, element, init, insert,
listen, noop, safe_not_equal, set_data, space, text} from "svelte/internal";
function create_fragment(ctx) {
let h1;
let t0;
let t1;
let t2;
let t3;
let t4;
let mounted;
let dispose;
return {
c() {
h1 = element("h1");
t0 = text("Hello ");
t1 = text(/*name*/ ctx[0]);
t2 = space();
t3 = text(/*number*/ ctx[1]);
t4 = text("!");
},
m(target, anchor) {
insert(target, h1, anchor);
append(h1, t0);
append(h1, t1);
append(h1, t2);
append(h1, t3);
append(h1, t4);
if (!mounted) {
dispose = listen(h1, "click", /*update*/ ctx[2]);
mounted = true;
}
},
p(ctx, [dirty]) {
if (dirty & /*name*/ 1) set_data(t1, /*name*/ ctx[0]);
if (dirty & /*number*/ 2) set_data(t3, /*number*/ ctx[1]);
},
i: noop,
o: noop,
d(detaching) {
if (detaching) detach(h1);
mounted = false;
dispose();
}
};
}
function instance($$self, $$props, $$invalidate) {
let name = 'Jonas';
let number = 0;
function update(e) {
$$invalidate(0, name = 'Bandi');
$$invalidate(1, number = 42);
}
return [name, number, update];
}
class App extends SvelteComponent {
constructor(options) {
super();
init(this, options, instance,
create_fragment, safe_not_equal, {});
}
}
export default App;
compiler
helper functions
life-cycle
m
o
u
n
t
c
r
e
a
t
e
u
n
m
o
u
n
t
u
p
d
a
t
e
instance scope
initialization
"r
e
a
c
t
iv
it
y"
51. Svelte Reactivity
Very compact and intuitive
code.
Fine-Grained Reactivity: only
runs the code that need to
be run.
Signi
fi
cantly faster than the
other mainstream
frameworks.
Strength Weakness
"extending" the semantics of
JavaScript
"Compile-Time-Generated Reactivity"
52. Circling Back:
All Modern Frontend Frameworks are Compilers!
Angular
• TypeScript
• Template
• (workarounds)
React
• JSX
• TypeScript
Vue
• SFC
• Template
• TypeScript
... but Svelte goes one step further.
53. "React Forget" - A Memoizing Compiler
https://www.youtube.com/watch?v=lGEMwh32soc
https://reactjs.org/blog/2022/06/15/react-labs-what-we-have-been-working-on-june-2022.html
Vue ReactivityTransforms
https://vuejs.org/guide/extras/reactivity-transform.html
https://github.com/vuejs/rfcs/discussions/369
React anVue have plans for future compiler features
that are changing the samantics of JavaScript ...
(reducing biolerplate for convenience)
Fun Fact: