Skip to content

Instantly share code, notes, and snippets.

@ridoansaleh
Last active December 9, 2019 14:47
Show Gist options
  • Save ridoansaleh/1c08644b2f1ac13f13391ba7b07934b5 to your computer and use it in GitHub Desktop.
Save ridoansaleh/1c08644b2f1ac13f13391ba7b07934b5 to your computer and use it in GitHub Desktop.

Loose Coupling in React.Js

Home page contains:

  • Filter
  • RequestList

Strategies :

1. S-1

  • Check localStorage (requests)
  • If there is no data, fetch all requests from data.js (Home)
  • Save it in localStorage
  • If there is data, continue to the next step
  • update state of Home which hold reqests data
  • Pass it to Filter and RequestList

Filter

Options

  • Change all requests by category selected by user
  • Need a function from Parent Component

Modal

  • Change all requests by category/categories searched by user
  • Also need a function from Parent Component
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment