Professional Documents
Culture Documents
Redux With LWC
Redux With LWC
Redux With LWC
Why Redux?
• Predictable. Centralized. Debuggable. Flexible.
LWC + Redux
• To Do List app
Redux Chrome Dev Tools
• Time-travel debugging and state visualization
About Einstein Unified UI
• Combining ML state with UI extensibility
Why Redux?
Predictable.
Centralized.
Debuggable.
Flexible.
Redux
Store
Image Source:
https://scriptverse.academy/tutorials/reactjs-redux-example.html
Image Source:
https://medium.com/@sameedhkhan/state-management-with-redux-in-lwc-545086a6732
Image Source:
https://digital55.com/como-aplicar-patron-redux-angular/
Steps to create new LWC Components
connected with the Redux Store
1. Create new Action Types constants
2. Create the Action Creators functions, which will
dispatch the Action Type
LWC + 3. Create the reducers to handle the action, and
create new state in the Redux Store
Redux 4. Create the selectors to extract the attributes from
Connect LWC the Redux state
components with 5. Create the LWC component that extends the
the Redux store lwcBinding component
6. If the LWC component updates the Redux state,
import the Actions created in step 3, and just call
the actions in the event handler of the component.
A To Do List App
A simple example of a Redux integration with LWC
Add Item
Toggle Item
Action Creators
Create the Action Creators, which will dispatch the Action Type
Add Item
Toggle Item
Reducers
Update the state of the store
• A reducer takes two arguments, the current state and the action that has been dispatched. The
current state is manipulated and returns a new state based on the action.
Day 2
● Working with Browsers and Web Standards to Evolve LWC [10:30 AM, Pine Theater]
● Lightning Web Security: Unlock the Power of LWC [10:30 AM, AppExchange Campfire]
● Streamline UI testing with UTAM [12:30 PM, Pine Theater]
● Building Lightning Web Components for Experience Cloud’s LWR [12:30 PM, Breakout 1]
● Integrate Redux with Lightning Web Components to Manage State [1:30 PM, Platform Theater]
RAD Women needs your help!
radwomen.org/be-a-part-
of-radwomen/
@radwomencode
How did we do?
Session Survey
● Please complete a session survey
● Located in the mobile app under
the session title
Thank You
LWC Communication
Child-to-parent communication
LWC Communication
Parent-to-child communication
Image Source:https://trailhead.salesforce.com/content/learn/projects/communicate-between-lightning-web-components/communicate-from-child-to-parent
LWC Communication
Unrelated component communication
Image Source:
https://trailhead.salesforce.com/content/learn/projects/communicate-between-lightning-web-components/communicate-betw
een-unrelated-components