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 Front-end For Your Drupal 8 Back-end
Search
Bassam Ismail
October 04, 2016
Technology
2
620
React Front-end For Your Drupal 8 Back-end
Bassam Ismail
October 04, 2016
Tweet
Share
More Decks by Bassam Ismail
See All by Bassam Ismail
CSS Architecture with OOCSS, SMACSS, and BEM
skippednote
3
170
Other Decks in Technology
See All in Technology
Forget efficiency – Become more productive without the stress
ufried
0
170
【若手エンジニア応援LT会】AWS Security Hubの活用に苦労した話
kazushi_ohata
0
240
Observability を実現するためにアセットを活用しよう(AWS 秋の Observability 祭り ~明日使えるアセット祭り~ )
tsujiba
0
100
Platform Engineering ことはじめ
oracle4engineer
PRO
3
310
小規模に始めるデータメッシュとデータガバナンスの実践
kimujun
4
630
物価高なラスベガスでの過ごし方
zakky
0
450
フルカイテン株式会社 採用資料
fullkaiten
0
36k
ジョブマッチングサービスにおける相互推薦システムの応用事例と課題
hakubishin3
1
400
リンクアンドモチベーション ソフトウェアエンジニア向け紹介資料 / Introduction to Link and Motivation for Software Engineers
lmi
4
290k
ZOZOTOWNのホーム画面をパーソナライズすることの難しさと裏話を語る
f6wbl6
0
160
チームを主語にしてみる / Making "Team" the Subject
ar_tama
4
330
「 SharePoint 難しい」ってよく聞くけど、そんなに言うなら8歳の息子に試してもらった
taichinakamura
2
740
Featured
See All Featured
Speed Design
sergeychernyshev
24
580
JavaScript: Past, Present, and Future - NDC Porto 2020
reverentgeek
47
5k
Practical Orchestrator
shlominoach
186
10k
YesSQL, Process and Tooling at Scale
rocio
167
14k
Typedesign – Prime Four
hannesfritz
39
2.4k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
Building Better People: How to give real-time feedback that sticks.
wjessup
363
19k
Designing Experiences People Love
moore
138
23k
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
126
18k
The Pragmatic Product Professional
lauravandoore
31
6.3k
What’s in a name? Adding method to the madness
productmarketing
PRO
22
3.1k
Statistics for Hackers
jakevdp
796
220k
Transcript
React Front-end for You Drupal 8 Back-end Bassam Ismail &
Aliya Khan Front-end | Intermediate
None
MArkETING 101
None
None
None
DUBLIN
None
“How to build a Headless Drupal WeBsite”
@skippednote bassam.co
@ALIYA_KHAN
None
✋
AGENDA • Exposing Drupal • React: Building Composable UIs •
Redux: Unidirectional Data Flow • React with Drupal
Exposing Drupal
None
None
None
None
None
None
Library ≄ Framework
None
UI Logic Markup Styling
None
None
Session List
Session
Session Fields
None
Destructured Props props = { title: “React & Drupal”, speaker:
“Bassam”, experience: “Intermediate” } React Components Pure Component
⨐(state) = UI React Component UI is function of the
Application state
Lifecycle Methods Event Handlers State and bindings No Mutations (Vdom)
MVC Controller View Model
Controlle View Model Controlle View Model Controlle View Model Controlle
View Model Controlle View Model Controlle View Model Controlle View Model Controlle View Model Controlle View Model
None
n items On Delete
“Redux is a predictable state container for JavaScript apps”
Components Application State
State Tree
• Actions and Action Creators • Reducer • Store
Increment DECREMENT Current Value
Action Action Creator
Action Creator Action OBJECT
Reducer
Action No Mutations
⨐(action, state) => newstate { type: “INCREMENT” } 1 0
Store
Create a store Get current state Dispatch Actions
React & Redux
Wrapper Component Provider with Store Root Component
None
connect Function Store State To Component Props
Dispatch Actions on onClick event React Component connected to Store
• Immutability • Composition • Pure Functions
*Disclaimer
React with Drupal
Use 8.2.0
None
None
None
None
Progressive Decoupling
Inside Theme
React Components Transpiled Files Includes Transpiled Files
Sessions Components Dependencies (React, ReactDOM, etc)
GET data from Drupal Update Component State Session Props
Destructured Session Props
None
None
None
Inside Module
React Components Templates to mount component Page Path Get initial
state
On visiting this URI Will be called Page title
Guzzle to Get view export data Called on ‘/sessions’ Pass
data to template Attach React Component
Mounted Component Initial State
Guzzle to Get view export data Called on ‘/sessions’ Pass
data to drupalSettings Attach React Component
Check for initial State
None
Fully Decoupled
JSON API
JSON API specification
Cleaner Output
Nested data
CLEANER OUTPUT
Sparse Fields
Sparse Fieldset Limited Fields
None
http: //con.dd/api/node/session?_format=api_json Namespace Entity Type Bundle Format Params
None
None
Apache
None
Getting Entity Collection
Getting SPECIFIC ID
ID
Authentication for CREATE, UPDATE & DELETE
OAUTH for Authentication
Post Data To Collection URL
Data to Update id = NID Session URL TO Update
Components Based on Routes on “/sessions/new” Load NewSession Component
Wrapper Component For Authenticated Routes
None
None
Demo
Thank You
Rate Our Session