You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
move logic from SearchForm into BusinessSearch component (state gets passed down as props)
fetchBusiness action creator dispatches actions and makes the api call.
rootReducer returns app state
create store in app.js
mapStateToProps --> BusinessSearch container has selected business available as a prop
create Business component (just create one to make sure you can access the data as
a prop) Actual business detail component/view will be done in another ticket.
add PropTypes to components
clean up code
Entry Point:
index.js
provider and create store here
Action Creators:
actions/index.js
requestBusinessDetail —> fetches business detail endpoint for selected business
receiveBusinessDetail —> receives business detail data
redux-thunk
actionCreator can return a function --> this function is executed through the middleware. Here we can make api calls using fetch.
check if this is necessary: use babel-polyfill and fetch from isomorphic-fetch for better browser support
fetchBusiness(business)
dispatches requestBusinessDetail
fetch call here
dispatches receiveBusinessDetail
handles success and failure states
gets selected business object passed down as props
Container Components:
BusinessSearch
move handleSearch, renderMenuItemChildren , and handleTypeaheadResultClick logic here
pass these down as props to SearchForm component
Component Hierarchy:
BusinessSearchContainer
SearchForm
BusinessDetail
InspectionsList
if you have props as an object you can pass it a spread operator in jsx to pass the whole props object {...props}. Its easy to accidentally pass props that are not needed this way.
The text was updated successfully, but these errors were encountered:
Guin-
changed the title
Plan Redux Implementation
redux stores business selection
May 25, 2017
BusinessSearch
container componentSearchForm
intoBusinessSearch
component (state gets passed down as props)fetchBusiness
action creator dispatches actions and makes the api call.rootReducer
returns app stateapp.js
Business
component (just create one to make sure you can access the data asa prop) Actual business detail component/view will be done in another ticket.
Entry Point:
index.js
provider and create store here
Action Creators:
actions/index.js
requestBusinessDetail —> fetches business detail endpoint for selected business
receiveBusinessDetail —> receives business detail data
redux-thunk
actionCreator can return a function --> this function is executed through the middleware. Here we can make api calls using fetch.
babel-polyfill
and fetch fromisomorphic-fetch
for better browser supportfetchBusiness(business)
dispatches requestBusinessDetail
fetch call here
dispatches receiveBusinessDetail
handles success and failure states
Design the State Shape:
Reducers:
reducers/index.js
import actions
businessDetail: returns default empty state or requestBusinessDetail, receiveBusinessDetail, business object
Presentational React Components:
SearchForm
BusinessDetail
Container Components:
BusinessSearch
handleSearch
,renderMenuItemChildren
, andhandleTypeaheadResultClick
logic hereSearchForm
componentComponent Hierarchy:
if you have props as an object you can pass it a spread operator in jsx to pass the whole props object
{...props}
. Its easy to accidentally pass props that are not needed this way.The text was updated successfully, but these errors were encountered: