Software architecture for freedom of engineering with React and it's ecosystem
Andrei Preda
reusable components
that's the future!
In a far away land, in a castle...
it's cool!
React components
<TheWrapper />
React
components from npm
Code structure
SearchInput component
Looks object oriented? :D
State 0
{
searchedTerm: ''
}
State 1
{
searchedTerm: 'biscuit'
}
user inputs
From React 0.14 +
we have stateless / function components
hmm..a global
immutable state object?
Note nowadays React uses
semver and it's version at 15.0.3
We need some friends
for what it's going to happen
vs.
The dragon
v 15.0.3
Redux dispatch an action
The action it's going in a journey / saga
Assuming
new ES6 features
Generator functions*
onChange
input event
it's decoupled
from the actual
component
1 - 0
Redux reducer captures 'RESULTS_FOUND'
2 - 0
The new state it's being generated after some logic have been applied on the raw data
The logic I/O it's separated and processed with Ramda.js
Assuming there is a function mapping the results to a
JSX <li> that components it's decoupled
from the state and does not need an inner state
React helps by offering components as functions
Side Effect free logic to handle the state / new state
Side Effect free logic
to handle async operations
and the flow of user interactions
PURE FUNCTIONS ONLY
Uses pure functions to map state directly to components
The logic doesn't resides in the components, so the components can transform, no more mountains?
Hills, sun & rabbits
From:
root
components
seatchInput
resultList
An application structured by features
that expose a public API
for other features to use and interact
into:
Easy to change and reusable
In the end,