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
0
61
React & Redux @ Grillcon 2017
React & Redux talk from Grillcon 2017
Mattias Lyckne
September 15, 2017
Tweet
Share
Other Decks in Programming
See All in Programming
15年続くIoTサービスのSREエンジニアが挑む分散トレーシング導入
melonps
2
210
「ブロックテーマでは再現できない」は本当か?
inc2734
0
1k
Honoを使ったリモートMCPサーバでAIツールとの連携を加速させる!
tosuri13
1
180
CSC307 Lecture 02
javiergs
PRO
1
780
AIエージェントのキホンから学ぶ「エージェンティックコーディング」実践入門
masahiro_nishimi
5
470
Fragmented Architectures
denyspoltorak
0
160
高速開発のためのコード整理術
sutetotanuki
1
400
AtCoder Conference 2025
shindannin
0
1.1k
ぼくの開発環境2026
yuzneri
0
240
AIフル活用時代だからこそ学んでおきたい働き方の心得
shinoyu
0
140
組織で育むオブザーバビリティ
ryota_hnk
0
180
AIによる開発の民主化を支える コンテキスト管理のこれまでとこれから
mulyu
3
320
Featured
See All Featured
From Legacy to Launchpad: Building Startup-Ready Communities
dugsong
0
140
Fireside Chat
paigeccino
41
3.8k
WENDY [Excerpt]
tessaabrams
9
36k
Practical Orchestrator
shlominoach
191
11k
世界の人気アプリ100個を分析して見えたペイウォール設計の心得
akihiro_kokubo
PRO
66
37k
Winning Ecommerce Organic Search in an AI Era - #searchnstuff2025
aleyda
1
1.9k
Information Architects: The Missing Link in Design Systems
soysaucechin
0
780
The World Runs on Bad Software
bkeepers
PRO
72
12k
Conquering PDFs: document understanding beyond plain text
inesmontani
PRO
4
2.3k
What does AI have to do with Human Rights?
axbom
PRO
0
2k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
12
1.4k
Effective software design: The role of men in debugging patriarchy in IT @ Voxxed Days AMS
baasie
0
230
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