SlideShare uma empresa Scribd logo
1 de 22
Baixar para ler offline
SINGLE STATE ATOM APPS
2
state =if
3
why don’t we put it
right on the root?
THE IDEA
4
main
<foo> <bar>
<qux>
state•State lives on the root
•Pass below only what matters
•Components just render

what it receives, no side-effects
5
BUT HOW DO WE
UPDATE THE STATE?
REACT + CURSOR
6
or atom, or zipper
REACT + CURSOR
7
<List items={cursor.refine('items')} />
const List = (props) =>
<ul>
{props.items.map(ListItem)}
</ul>
const ListItem = (item) =>
<li>
{item.refine('name').value}
<NameInput name={item.refine('name')} />
</li>
const NameInput = (props) =>
<input value={props.name.value}

onChange={props.name.set} />
(not an actual implementation)
CLOJURESCRIPT + OM
Single state atom
8
9
AWESOME DEMO
https://youtu.be/5yHFTN-_mOo
10
TODOMVC EXAMPLE
REACT + REDUX
11
Reduce FTW
R
WHAT IS A REDUCER?
12
const list = [1, 2, 3]
list.reduce((accumulated, current) => {
return accumulated + current
}, 5)
// 11
REDUX STRUCTURE
13
main
<foo> <bar>
<qux>
stateactions
user input
reduce
onChange
HOW REDUX WORKS
14
const state = {
list: [{name: "une"}, {name: "due"}]
};
const actions = [{type: "ADD", name: "tre"}];
const reducer = (currentState, action) => {
switch (action.type) {
case "ADD":
return {
list: [...currentState.list, {name: action.name})
}
default:
return currentState;
}
}
actions.reduce(reducer, state); /*
{
list: [{name: "une"}, {name: "due"}, {name: "tre"}]
};
*/
15
TODOMVC EXAMPLE
16
REDUX DEVTOOLS
ELM
17
The right way is the only way
18
EXAMPLE
ADVANTAGES
19
•Single source of truth
•Deterministic state changes
•Rationalise about the rendered UI
•State change timeline
•Easier to debug
•Hot reloading (example)
•Fast rendering
•Easier to implement optimistic updates
•Easier to have an isomorphic app
•Simple functions and data structures
20
WHY IS THIS HAPPENING
ON FRONT-END?
21
EXAMPLES SOURCE CODE
github.com/rogeriochaves/single-state-atom-apps
THANK YOU

Mais conteúdo relacionado

Destaque

SPI Annual Meeting Recognition List (New)
SPI Annual Meeting Recognition List (New)SPI Annual Meeting Recognition List (New)
SPI Annual Meeting Recognition List (New)spisolutions
 
เครื่องใช้ไฟฟ้าในปัจจุบัน
เครื่องใช้ไฟฟ้าในปัจจุบันเครื่องใช้ไฟฟ้าในปัจจุบัน
เครื่องใช้ไฟฟ้าในปัจจุบันNatdanai Kumpao
 
People. nature and portraits pics
People. nature and portraits picsPeople. nature and portraits pics
People. nature and portraits picsHira Farooq
 
Something to Give, Something to Gain
Something to Give, Something to GainSomething to Give, Something to Gain
Something to Give, Something to Gainspisolutions
 
Jan lokpal tamil by mohan-mba-sasurie
Jan lokpal tamil by mohan-mba-sasurieJan lokpal tamil by mohan-mba-sasurie
Jan lokpal tamil by mohan-mba-sasurieMohan Kumar
 
Destributed RES power gen in Greece incentives [2011]
Destributed RES power gen in Greece incentives [2011]Destributed RES power gen in Greece incentives [2011]
Destributed RES power gen in Greece incentives [2011]Constantinos Faitatzoglou
 
Paper caso cinco terra con Daniella Mazzonis y Marco Dini
Paper caso cinco terra con Daniella Mazzonis y Marco DiniPaper caso cinco terra con Daniella Mazzonis y Marco Dini
Paper caso cinco terra con Daniella Mazzonis y Marco DiniConectaDEL
 
Finalculturaladventure
FinalculturaladventureFinalculturaladventure
Finalculturaladventure14771
 

Destaque (15)

Self-testing Code
Self-testing CodeSelf-testing Code
Self-testing Code
 
Introduction to Elm
Introduction to ElmIntroduction to Elm
Introduction to Elm
 
Playing with RxJS
Playing with RxJSPlaying with RxJS
Playing with RxJS
 
SPI Annual Meeting Recognition List (New)
SPI Annual Meeting Recognition List (New)SPI Annual Meeting Recognition List (New)
SPI Annual Meeting Recognition List (New)
 
เครื่องใช้ไฟฟ้าในปัจจุบัน
เครื่องใช้ไฟฟ้าในปัจจุบันเครื่องใช้ไฟฟ้าในปัจจุบัน
เครื่องใช้ไฟฟ้าในปัจจุบัน
 
People. nature and portraits pics
People. nature and portraits picsPeople. nature and portraits pics
People. nature and portraits pics
 
Woollen Shaggy
Woollen ShaggyWoollen Shaggy
Woollen Shaggy
 
Texture Rugs Tulsiram
Texture Rugs TulsiramTexture Rugs Tulsiram
Texture Rugs Tulsiram
 
Something to Give, Something to Gain
Something to Give, Something to GainSomething to Give, Something to Gain
Something to Give, Something to Gain
 
Jan lokpal tamil by mohan-mba-sasurie
Jan lokpal tamil by mohan-mba-sasurieJan lokpal tamil by mohan-mba-sasurie
Jan lokpal tamil by mohan-mba-sasurie
 
Világos?!...
Világos?!...Világos?!...
Világos?!...
 
Ecommerce 101
Ecommerce 101Ecommerce 101
Ecommerce 101
 
Destributed RES power gen in Greece incentives [2011]
Destributed RES power gen in Greece incentives [2011]Destributed RES power gen in Greece incentives [2011]
Destributed RES power gen in Greece incentives [2011]
 
Paper caso cinco terra con Daniella Mazzonis y Marco Dini
Paper caso cinco terra con Daniella Mazzonis y Marco DiniPaper caso cinco terra con Daniella Mazzonis y Marco Dini
Paper caso cinco terra con Daniella Mazzonis y Marco Dini
 
Finalculturaladventure
FinalculturaladventureFinalculturaladventure
Finalculturaladventure
 

Semelhante a Single State Atom Apps Summary

JAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docx
JAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docxJAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docx
JAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docxGavinUJtMathist
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOJorge Vásquez
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-listpinakspatel
 
React performance tips, Тельман Агабабов
React performance tips, Тельман АгабабовReact performance tips, Тельман Агабабов
React performance tips, Тельман АгабабовSigma Software
 
Mobx Performance and Sanity
Mobx Performance and SanityMobx Performance and Sanity
Mobx Performance and Sanity500Tech
 
Array data structure
Array data structureArray data structure
Array data structureharsh112327
 
Array data structure
Array data structureArray data structure
Array data structuremaamir farooq
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applicationsAhsan Mansiv
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTUREMandeep Singh
 
A Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptA Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptjonathanfmills
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfannaelctronics
 
c++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdfc++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdfakpatra2000
 
Create a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docxCreate a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docxmrichard5
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docxajoy21
 
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...davidwarner122
 
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdfimplement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdfFOREVERPRODUCTCHD
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfmayorothenguyenhob69
 

Semelhante a Single State Atom Apps Summary (20)

JAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docx
JAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docxJAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docx
JAVA Demonstrate the use of your APL in a PartB_Driver class by doing.docx
 
A Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIOA Prelude of Purity: Scaling Back ZIO
A Prelude of Purity: Scaling Back ZIO
 
Stacks,queues,linked-list
Stacks,queues,linked-listStacks,queues,linked-list
Stacks,queues,linked-list
 
React performance tips, Тельман Агабабов
React performance tips, Тельман АгабабовReact performance tips, Тельман Агабабов
React performance tips, Тельман Агабабов
 
Mobx Performance and Sanity
Mobx Performance and SanityMobx Performance and Sanity
Mobx Performance and Sanity
 
Array data structure
Array data structureArray data structure
Array data structure
 
Array data structure
Array data structureArray data structure
Array data structure
 
Stack and its applications
Stack and its applicationsStack and its applications
Stack and its applications
 
Unit 3 stack
Unit 3   stackUnit 3   stack
Unit 3 stack
 
Stacks in DATA STRUCTURE
Stacks in DATA STRUCTUREStacks in DATA STRUCTURE
Stacks in DATA STRUCTURE
 
Java Generics
Java GenericsJava Generics
Java Generics
 
A Skeptics guide to functional style javascript
A Skeptics guide to functional style javascriptA Skeptics guide to functional style javascript
A Skeptics guide to functional style javascript
 
Hi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdfHi,I have added the methods and main class as per your requirement.pdf
Hi,I have added the methods and main class as per your requirement.pdf
 
c++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdfc++Write a program to test the selection sort algorithm for array-.pdf
c++Write a program to test the selection sort algorithm for array-.pdf
 
Create a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docxCreate a JAVA Program that traverses through an array recursively- rat.docx
Create a JAVA Program that traverses through an array recursively- rat.docx
 
Stack.pptx
Stack.pptxStack.pptx
Stack.pptx
 
Write a program to find the number of comparisons using the binary se.docx
 Write a program to find the number of comparisons using the binary se.docx Write a program to find the number of comparisons using the binary se.docx
Write a program to find the number of comparisons using the binary se.docx
 
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...Below is a given ArrayList class and Main class  Your Dreams Our Mission/tuto...
Below is a given ArrayList class and Main class Your Dreams Our Mission/tuto...
 
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdfimplement the ListLinked ADT (the declaration is given in ListLinked.pdf
implement the ListLinked ADT (the declaration is given in ListLinked.pdf
 
BackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdfBackgroundIn many applications, the composition of a collection o.pdf
BackgroundIn many applications, the composition of a collection o.pdf
 

Último

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendArshad QA
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...harshavardhanraghave
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxbodapatigopi8531
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdfWave PLM
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfCionsystems
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️anilsa9823
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....ShaimaaMohamedGalal
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantAxelRicardoTrocheRiq
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerThousandEyes
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsAndolasoft Inc
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...MyIntelliSource, Inc.
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about usDynamic Netsoft
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comFatema Valibhai
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...OnePlan Solutions
 

Último (20)

Test Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and BackendTest Automation Strategy for Frontend and Backend
Test Automation Strategy for Frontend and Backend
 
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
Reassessing the Bedrock of Clinical Function Models: An Examination of Large ...
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
Hand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptxHand gesture recognition PROJECT PPT.pptx
Hand gesture recognition PROJECT PPT.pptx
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf5 Signs You Need a Fashion PLM Software.pdf
5 Signs You Need a Fashion PLM Software.pdf
 
Active Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdfActive Directory Penetration Testing, cionsystems.com.pdf
Active Directory Penetration Testing, cionsystems.com.pdf
 
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS LiveVip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
Vip Call Girls Noida ➡️ Delhi ➡️ 9999965857 No Advance 24HRS Live
 
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online  ☂️
CALL ON ➥8923113531 🔝Call Girls Kakori Lucknow best sexual service Online ☂️
 
Clustering techniques data mining book ....
Clustering techniques data mining book ....Clustering techniques data mining book ....
Clustering techniques data mining book ....
 
Salesforce Certified Field Service Consultant
Salesforce Certified Field Service ConsultantSalesforce Certified Field Service Consultant
Salesforce Certified Field Service Consultant
 
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected WorkerHow To Troubleshoot Collaboration Apps for the Modern Connected Worker
How To Troubleshoot Collaboration Apps for the Modern Connected Worker
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
How To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.jsHow To Use Server-Side Rendering with Nuxt.js
How To Use Server-Side Rendering with Nuxt.js
 
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
Try MyIntelliAccount Cloud Accounting Software As A Service Solution Risk Fre...
 
DNT_Corporate presentation know about us
DNT_Corporate presentation know about usDNT_Corporate presentation know about us
DNT_Corporate presentation know about us
 
HR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.comHR Software Buyers Guide in 2024 - HRSoftware.com
HR Software Buyers Guide in 2024 - HRSoftware.com
 
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
Tech Tuesday-Harness the Power of Effective Resource Planning with OnePlan’s ...
 
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...Call Girls In Mukherjee Nagar 📱  9999965857  🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
Call Girls In Mukherjee Nagar 📱 9999965857 🤩 Delhi 🫦 HOT AND SEXY VVIP 🍎 SE...
 

Single State Atom Apps Summary