Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
React & Redux @ Grillcon 2017
Search
Mattias Lyckne
September 15, 2017
Programming
62
0
Share
React & Redux @ Grillcon 2017
React & Redux talk from Grillcon 2017
Mattias Lyckne
September 15, 2017
Other Decks in Programming
See All in Programming
CDK Deployのための ”反響定位”
watany
4
710
The Monolith Strikes Back: Why AI Agents ❤️ Rails Monoliths
serradura
0
310
レガシーPHP転生 〜父がドメインエキスパートだったのでDDD+Claude Codeでチート開発します〜
panda_program
0
710
AWS re:Invent 2025の少し振り返り + DevOps AgentとBacklogを連携させてみた
satoshi256kbyte
3
160
ハーネスエンジニアリングにどう向き合うか 〜ルールファイルを超えて開発プロセスを設計する〜 / How to approach harness engineering
rkaga
9
2.4k
Codex CLI でつくる、Issue から merge までの開発フロー
amata1219
0
350
それはエンジニアリングの糧である:AI開発のためにAIのOSSを開発する現場より / It serves as fuel for engineering: insights from the field of developing open-source AI for AI development.
nrslib
1
840
Coding as Prompting Since 2025
ragingwind
0
820
AIエージェントで業務改善してみた
taku271
0
510
今年もTECHSCOREブログを書き続けます!
hiraoku101
0
250
Rethinking API Platform Filters
vinceamstoutz
0
11k
安いハードウェアでVulkan
fadis
1
960
Featured
See All Featured
Introduction to Domain-Driven Design and Collaborative software design
baasie
1
720
KATA
mclloyd
PRO
35
15k
The browser strikes back
jonoalderson
0
950
[RailsConf 2023] Rails as a piece of cake
palkan
59
6.5k
Marketing to machines
jonoalderson
1
5.2k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
27
3.4k
Why Mistakes Are the Best Teachers: Turning Failure into a Pathway for Growth
auna
0
120
[SF Ruby Conf 2025] Rails X
palkan
2
940
Taking LLMs out of the black box: A practical guide to human-in-the-loop distillation
inesmontani
PRO
3
2.1k
Primal Persuasion: How to Engage the Brain for Learning That Lasts
tmiket
0
320
JAMstack: Web Apps at Ludicrous Speed - All Things Open 2022
reverentgeek
1
420
How To Speak Unicorn (iThemes Webinar)
marktimemedia
1
430
Transcript
React & Redux
Web, internet och programvaruteknik Winterkvist.com Prisjakt Mattias Lyckne
React
” A Javascript Library for buidling user interfaces
Learn Once, Write Anywhere
React React Native React Native Windows React Native for web
React VR React Hardware React PDF Learn Once, Write Anywhere React DocX React Sketchapp React Blessed Spectacle and much more
None
function Text(props) { return <p>{props.text}</p>; }
import React from 'react'; class Text extends React.Component { render()
{ return <p>{this.props.text}</p>; } }
import React from 'react'; import Text from './text'; import ReactDOM
from 'react-dom'; ReactDOM.render( <Text text="Hello Grillcon!" />, document.getElementById('root') );
import React from 'react'; class TextInput extends React.Component { constructor(props)
{ super(props); this.state = { text: props.text }; } handleChange(evt) { this.setState({text: evt.target.value}); } render() { return ( <div> <input onChange={this.handleChange} value={this.state.text} /> <p>{this.state.text}</p> </div> ); } }
Internal state Lifecycle methods Stateful component No internal state No
lifecycle methods Stateless component
DEMO
None
Redux
” Redux is a predictable state container for JavaScript apps.
Actions Redux Reducers Store
Payload of information you send to the store. Actions {
type: 'SAVE_SEARCH', query: 'Playstation' }
Function that creates an action Action creators function saveSearch(query) {
return { type: 'SAVE_SEARCH', query: query, }; }
Take an action and specify how the application states changes.
Reducers function reducer(state, action) { if (action.type === 'SAVE_SEARCH') { return { ...state, savedSearches: state.savedSearches.concat(action.query) }; } return state; }
Brings the actions and reducers together. Holds the application state.
Store
1. store.dispatch(action); 2. Redux store calls the reducer 3. Redux
store saves the state returned by the root reducer Redux flow
yarn add redux react-redux Install
DEMO
None
What about side effects?
Aims to make side effects easier and better Redux Saga
Testing
Easy setup Instant feedback Snapshots Jest React Testing Utility jQuery-like
API to manipulate and traverse React components Enzyme
import { shallow } from enzyme; import SaveSearch from '../save-search';
describe('SaveSearch', () => { it('renders without crashing', () => { shallow(<SaveSearch />); }); it('calls function on onClick', () => { const func = jest.fn(); const wrapper = shallow(<SaveSearch onClick={func} />); wrapper.find('button').simulate('click'); expect(func).toHaveBeenCalled(); }); });
yarn create react-app yarn add redux react-redux yarn add --dev
redux-devtools yarn add --dev enzyme react-test-renderer Start coding
Questions?
[email protected]
@MattiasLyckne
None