SlideShare a Scribd company logo
“Let’s Start With
REDUX”
Cubet Seminar
Presented by “Pooja Jayaraj ”
“We help build and architect IT solutions”
About Cubet
Founded in 2007, Cubet Techno Labs
is an end-to-end SMAC (social,
mobile, analytics and cloud) consulting
company with offices at Kochi, India
and London, UK. With expertise in
insightful product strategy, well-crafted
design and proficient development for
high-end web and mobile application
technologies.
Where we stand
Visit – www.cubettech.com
What is Redux ?
Visit – www.cubettech.com
❖Predictable state container for javascript apps
❖Redux is an evolution of a concept called flux
❖Light weight implementation of flux (24 kb)
❖Redux was created by Dan Abramov around June 2015
Why Redux ?
Visit – www.cubettech.com
 One way data flow
 State is immutable
 Easily testable.
 We can write Redux apps with React, Angular, Ember, jQuery, or
vanilla JavaScript.
 Relies heavily on functional programming language
Installation
Visit – www.cubettech.com
● To install stable version, npm install --save redux
● Complementary Packages
○ npm install --save react-redux
○ npm install --save-dev redux-devtools
Using redux-devtools we can ,live code editing combined with a time
traveling debugger.
Visit – www.cubettech.com
Three Principles:
Visit – www.cubettech.com
 Action
 Reducers
 Store
Visit – www.cubettech.com
Presentational and Container
Components
Visit – www.cubettech.com
 A Presentational Component is a component that just renders
HTML
 Presentational Component does not interact with the Redux store
 Presentational Component accepts input like props from a
Container Component
 The Container Component specifies the data and state a
presentational component should render
 Container Component is the one to dispatch an action to the
Redux store
Visit – www.cubettech.com
Action
Visit – www.cubettech.com
 An action in Redux is a payload of information
 Changes are made with pure javascript functions
 Represented using json with type attribute and state object
 Action will be dispatched to a reducer
 Action Creator - it's simply a function which creates action
Example :
Visit – www.cubettech.com
dispatch(addTodo(text)) - call from component
function addTodo(text) {
return {
type: ADD_TODO,
text
}
}
Reducer:
Visit – www.cubettech.com
 Takes an action and a state, returns a new state
 (previousState, action) => newState
 Pure javascript functions
 combineReducers(reducers)
 A helper function turns an object whose values are
different reducing functions into a single reducing function
you can pass to createStore.
Example :
Visit – www.cubettech.com
function todos(state = [], action) {
switch (action.type) {
case 'ADD_TODO':
return state.concat([ action.text ])
default:
return state
}
}
Visit – www.cubettech.com
let todoApp = combineReducers({
todos,
visibleTodoFilter
})
Result:
return {
todos: nextTodos,
visibleTodoFilter: nextVisibleTodoFilter
}
Store
Visit – www.cubettech.com
A store holds the whole state tree of your application.
The only way to change the state inside it is to dispatch an action on it.
There should only be a single store in your app
Methods to interact with store
● getState()
● dispatch(action)
● subscribe(listener)
● replaceReducer(nextReducer)
Visit – www.cubettech.com
getState()
Returns the current state tree of your application.
Eg:- const myErrors = store.getState().errors;
dispatch(action)
Dispatches an action. This is the only way to trigger a state change
We can include custom middleware functions to the dispatch method of
your store
Visit – www.cubettech.com
subscribe(listener)
Adds a change listener
It will be called any time an action is dispatched
replaceReducer(nextReducer)
Advanced api
Replaces the reducer currently used by the store to calculate the
state.
Example:
Visit – www.cubettech.com
import { createStore } from 'redux'
let store = createStore(todoApp)
store.subscribe(listener)
console.log(store.getState())
Visit – www.cubettech.com
Conclusion
Visit – www.cubettech.com
 Redux is powerful for building predictable, testable maintainable
interface
 Redux makes you a better UI engineer by forcing you to handle state
changes explicitly
 Redux allows you to manage state with a minimal API but completely
predictable behaviour
Our Technologies Stack:
Server Side Application JavaScript Frameworks
Mobile App Development
Database System and Cloud
Visit – www.cubettech.com
THANKS!
ANY QUESTIONS? PLEASE GET IN TOUCH!
www.cubettech.com
Email : info@cubettech.com
Skype : cubet.se
Phone: +91 484 405 4324
Contact us:
Kemp House
160 City Road
London- EC1V2NX,
UK.info@cubettech.com
+44 2071938618
Carnival Info Park,
Unit IX-C, 9th floor PhaseIV,
Kochi, Kerala, India
info@cubettech.com
+91 484 4054324

More Related Content

Similar to Let's start with REDUX

Redux workshop
Redux workshopRedux workshop
Redux workshop
Imran Sayed
 
React Redux AntD and Umi js
React Redux AntD and Umi jsReact Redux AntD and Umi js
React Redux AntD and Umi js
Isuru Samaraweera
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
Citrix
 
How to use redux with react hooks in react native application
How to use redux with react hooks in react native applicationHow to use redux with react hooks in react native application
How to use redux with react hooks in react native application
Katy Slemon
 
An approach to responsive, realtime with Backbone.js and WebSockets
An approach to responsive, realtime with Backbone.js and WebSocketsAn approach to responsive, realtime with Backbone.js and WebSockets
An approach to responsive, realtime with Backbone.js and WebSockets
Andrei Sebastian Cîmpean
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
Tariqul islam
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
Cuong Ho
 
Vuex
VuexVuex
Alphorm.com Formation Redux : Niveau Avancé
Alphorm.com Formation Redux : Niveau AvancéAlphorm.com Formation Redux : Niveau Avancé
Alphorm.com Formation Redux : Niveau Avancé
Alphorm
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
Binary Studio
 
React js
React jsReact js
React js
Rajesh Kolla
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
Vedran Blaženka
 
Redux data flow with angular
Redux data flow with angularRedux data flow with angular
Redux data flow with angular
Gil Fink
 
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's ReduxManage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
Commit University
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptx
NavneetKumar111924
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
Elyse Kolker Gordon
 
Redux with angular 2 - workshop 2016
Redux with angular 2 - workshop 2016Redux with angular 2 - workshop 2016
Redux with angular 2 - workshop 2016
Nir Kaufman
 
Redux
ReduxRedux
Reactивная тяга
Reactивная тягаReactивная тяга
Reactивная тяга
Vitebsk Miniq
 
Battle of React State Managers in frontend applications
Battle of React State Managers in frontend applicationsBattle of React State Managers in frontend applications
Battle of React State Managers in frontend applications
Evangelia Mitsopoulou
 

Similar to Let's start with REDUX (20)

Redux workshop
Redux workshopRedux workshop
Redux workshop
 
React Redux AntD and Umi js
React Redux AntD and Umi jsReact Redux AntD and Umi js
React Redux AntD and Umi js
 
Getting started with Redux js
Getting started with Redux jsGetting started with Redux js
Getting started with Redux js
 
How to use redux with react hooks in react native application
How to use redux with react hooks in react native applicationHow to use redux with react hooks in react native application
How to use redux with react hooks in react native application
 
An approach to responsive, realtime with Backbone.js and WebSockets
An approach to responsive, realtime with Backbone.js and WebSocketsAn approach to responsive, realtime with Backbone.js and WebSockets
An approach to responsive, realtime with Backbone.js and WebSockets
 
React js programming concept
React js programming conceptReact js programming concept
React js programming concept
 
Introduction to react and redux
Introduction to react and reduxIntroduction to react and redux
Introduction to react and redux
 
Vuex
VuexVuex
Vuex
 
Alphorm.com Formation Redux : Niveau Avancé
Alphorm.com Formation Redux : Niveau AvancéAlphorm.com Formation Redux : Niveau Avancé
Alphorm.com Formation Redux : Niveau Avancé
 
Academy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & ToolingAcademy PRO: React JS. Redux & Tooling
Academy PRO: React JS. Redux & Tooling
 
React js
React jsReact js
React js
 
React state managmenet with Redux
React state managmenet with ReduxReact state managmenet with Redux
React state managmenet with Redux
 
Redux data flow with angular
Redux data flow with angularRedux data flow with angular
Redux data flow with angular
 
Manage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's ReduxManage the Flux of your Web Application: Let's Redux
Manage the Flux of your Web Application: Let's Redux
 
downloads_introduction to redux.pptx
downloads_introduction to redux.pptxdownloads_introduction to redux.pptx
downloads_introduction to redux.pptx
 
Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017Building Universal Web Apps with React ForwardJS 2017
Building Universal Web Apps with React ForwardJS 2017
 
Redux with angular 2 - workshop 2016
Redux with angular 2 - workshop 2016Redux with angular 2 - workshop 2016
Redux with angular 2 - workshop 2016
 
Redux
ReduxRedux
Redux
 
Reactивная тяга
Reactивная тягаReactивная тяга
Reactивная тяга
 
Battle of React State Managers in frontend applications
Battle of React State Managers in frontend applicationsBattle of React State Managers in frontend applications
Battle of React State Managers in frontend applications
 

More from Cubet Techno Labs

Sass_Cubet seminar
Sass_Cubet seminarSass_Cubet seminar
Sass_Cubet seminar
Cubet Techno Labs
 
Drupal_cubet seminar
Drupal_cubet seminarDrupal_cubet seminar
Drupal_cubet seminar
Cubet Techno Labs
 
JMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar pptJMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar ppt
Cubet Techno Labs
 
Fabricjs ppt
Fabricjs pptFabricjs ppt
Fabricjs ppt
Cubet Techno Labs
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
Cubet Techno Labs
 
Angularjs 2
Angularjs 2 Angularjs 2
Angularjs 2
Cubet Techno Labs
 

More from Cubet Techno Labs (6)

Sass_Cubet seminar
Sass_Cubet seminarSass_Cubet seminar
Sass_Cubet seminar
 
Drupal_cubet seminar
Drupal_cubet seminarDrupal_cubet seminar
Drupal_cubet seminar
 
JMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar pptJMeter_ Cubet Seminar ppt
JMeter_ Cubet Seminar ppt
 
Fabricjs ppt
Fabricjs pptFabricjs ppt
Fabricjs ppt
 
An Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using ProtractorAn Introduction to AngularJS End to End Testing using Protractor
An Introduction to AngularJS End to End Testing using Protractor
 
Angularjs 2
Angularjs 2 Angularjs 2
Angularjs 2
 

Recently uploaded

Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
Zilliz
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
kumardaparthi1024
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
DianaGray10
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
panagenda
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
Neo4j
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
Tomaz Bratanic
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
Pixlogix Infotech
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
Zilliz
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
panagenda
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
Edge AI and Vision Alliance
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
Zilliz
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Speck&Tech
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Safe Software
 

Recently uploaded (20)

Infrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI modelsInfrastructure Challenges in Scaling RAG with Custom AI models
Infrastructure Challenges in Scaling RAG with Custom AI models
 
How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
GenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizationsGenAI Pilot Implementation in the organizations
GenAI Pilot Implementation in the organizations
 
UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6UiPath Test Automation using UiPath Test Suite series, part 6
UiPath Test Automation using UiPath Test Suite series, part 6
 
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAUHCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
HCL Notes und Domino Lizenzkostenreduzierung in der Welt von DLAU
 
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024GraphSummit Singapore | The Art of the  Possible with Graph - Q2 2024
GraphSummit Singapore | The Art of the Possible with Graph - Q2 2024
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
GraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracyGraphRAG for Life Science to increase LLM accuracy
GraphRAG for Life Science to increase LLM accuracy
 
Best 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERPBest 20 SEO Techniques To Improve Website Visibility In SERP
Best 20 SEO Techniques To Improve Website Visibility In SERP
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Programming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup SlidesProgramming Foundation Models with DSPy - Meetup Slides
Programming Foundation Models with DSPy - Meetup Slides
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
HCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAUHCL Notes and Domino License Cost Reduction in the World of DLAU
HCL Notes and Domino License Cost Reduction in the World of DLAU
 
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
“Building and Scaling AI Applications with the Nx AI Manager,” a Presentation...
 
Full-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalizationFull-RAG: A modern architecture for hyper-personalization
Full-RAG: A modern architecture for hyper-personalization
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
Cosa hanno in comune un mattoncino Lego e la backdoor XZ?
 
Driving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success StoryDriving Business Innovation: Latest Generative AI Advancements & Success Story
Driving Business Innovation: Latest Generative AI Advancements & Success Story
 

Let's start with REDUX

  • 1. “Let’s Start With REDUX” Cubet Seminar Presented by “Pooja Jayaraj ” “We help build and architect IT solutions”
  • 2. About Cubet Founded in 2007, Cubet Techno Labs is an end-to-end SMAC (social, mobile, analytics and cloud) consulting company with offices at Kochi, India and London, UK. With expertise in insightful product strategy, well-crafted design and proficient development for high-end web and mobile application technologies. Where we stand Visit – www.cubettech.com
  • 3. What is Redux ? Visit – www.cubettech.com ❖Predictable state container for javascript apps ❖Redux is an evolution of a concept called flux ❖Light weight implementation of flux (24 kb) ❖Redux was created by Dan Abramov around June 2015
  • 4. Why Redux ? Visit – www.cubettech.com  One way data flow  State is immutable  Easily testable.  We can write Redux apps with React, Angular, Ember, jQuery, or vanilla JavaScript.  Relies heavily on functional programming language
  • 5. Installation Visit – www.cubettech.com ● To install stable version, npm install --save redux ● Complementary Packages ○ npm install --save react-redux ○ npm install --save-dev redux-devtools Using redux-devtools we can ,live code editing combined with a time traveling debugger.
  • 7. Three Principles: Visit – www.cubettech.com  Action  Reducers  Store
  • 9. Presentational and Container Components Visit – www.cubettech.com  A Presentational Component is a component that just renders HTML  Presentational Component does not interact with the Redux store  Presentational Component accepts input like props from a Container Component  The Container Component specifies the data and state a presentational component should render  Container Component is the one to dispatch an action to the Redux store
  • 11. Action Visit – www.cubettech.com  An action in Redux is a payload of information  Changes are made with pure javascript functions  Represented using json with type attribute and state object  Action will be dispatched to a reducer  Action Creator - it's simply a function which creates action
  • 12. Example : Visit – www.cubettech.com dispatch(addTodo(text)) - call from component function addTodo(text) { return { type: ADD_TODO, text } }
  • 13. Reducer: Visit – www.cubettech.com  Takes an action and a state, returns a new state  (previousState, action) => newState  Pure javascript functions  combineReducers(reducers)  A helper function turns an object whose values are different reducing functions into a single reducing function you can pass to createStore.
  • 14. Example : Visit – www.cubettech.com function todos(state = [], action) { switch (action.type) { case 'ADD_TODO': return state.concat([ action.text ]) default: return state } }
  • 15. Visit – www.cubettech.com let todoApp = combineReducers({ todos, visibleTodoFilter }) Result: return { todos: nextTodos, visibleTodoFilter: nextVisibleTodoFilter }
  • 16. Store Visit – www.cubettech.com A store holds the whole state tree of your application. The only way to change the state inside it is to dispatch an action on it. There should only be a single store in your app Methods to interact with store ● getState() ● dispatch(action) ● subscribe(listener) ● replaceReducer(nextReducer)
  • 17. Visit – www.cubettech.com getState() Returns the current state tree of your application. Eg:- const myErrors = store.getState().errors; dispatch(action) Dispatches an action. This is the only way to trigger a state change We can include custom middleware functions to the dispatch method of your store
  • 18. Visit – www.cubettech.com subscribe(listener) Adds a change listener It will be called any time an action is dispatched replaceReducer(nextReducer) Advanced api Replaces the reducer currently used by the store to calculate the state.
  • 19. Example: Visit – www.cubettech.com import { createStore } from 'redux' let store = createStore(todoApp) store.subscribe(listener) console.log(store.getState())
  • 21. Conclusion Visit – www.cubettech.com  Redux is powerful for building predictable, testable maintainable interface  Redux makes you a better UI engineer by forcing you to handle state changes explicitly  Redux allows you to manage state with a minimal API but completely predictable behaviour
  • 22. Our Technologies Stack: Server Side Application JavaScript Frameworks Mobile App Development Database System and Cloud Visit – www.cubettech.com
  • 23. THANKS! ANY QUESTIONS? PLEASE GET IN TOUCH! www.cubettech.com Email : info@cubettech.com Skype : cubet.se Phone: +91 484 405 4324
  • 24. Contact us: Kemp House 160 City Road London- EC1V2NX, UK.info@cubettech.com +44 2071938618 Carnival Info Park, Unit IX-C, 9th floor PhaseIV, Kochi, Kerala, India info@cubettech.com +91 484 4054324