Folders and files Name Name Last commit message
Last commit date
parent directory
View all files
Goal - understand basics of react router and redux
[goal] add second page showing summary of all notes, that can be accessed from menu in header
[exercise - refactor] move logic from App.js to separate component - EditNotesPage.js
create component EditNotesPage and move logic from App.js to this new component (this breaks everything for now)
create folder editNotesPage and move all related components to it
fix paths in moved components, so it builds
[theory] react router
[demo] add one link to header and point it to EditNotesPage
[exercise] create second page with summary
create new folder summaryPage
create new component summaryPage and make it display titles of all notes (won't work for now, we broke stuff in our refactor)
make the new component display some dummy data for now
npm i --save 'react-router-dom'
add link to the header and make it work
[theory] redux
overview
three principles
why to use redux
disadvantages
[demo] add redux to to editNotesPage
[demo] combining reducers
[exercise]
npm install --save react-redux
add redux to header
[theory] redux vs local state
Changes since end of workshop
added redux-logger package (dont forget to run 'npm i'), so if you open your browser console, you will see every state change there, like so
removed combining reducers - everything is now in Reducer.js (it was unnecessary so far and confusing)
action types are now string constants inside Reducer.js - it's very recommended to use constants instead of typing it in every time
connected NewNoteModal.js to redux store and added NOTE_ADDED action - notice how action is dispatched there
Exercise @home - connect Header to redux store and make it display number of notes
it's better to pass to the component only number of notes - this components doesn't need to have access to whole array
Exercise @home - connect SummaryPage to redux store and make it display all note titles as a list
Exercise @home (for bonus points) - add MAKE ALL CAPS button
add MAKE ALL CAPS button next to edit and remove buttons, that will make make title of the note all UPPER CASE
it's useful if you want to easily make a note REALLY IMPORTANT
should be done through new action, with action.type = 'NOTE_MAKE_TITLE_ALL_CAPS'
You can’t perform that action at this time.