/graphql-react-apollo

Using graphql to show example using organization and users simple CRUD operations with belong_to and has_many relationship

Primary LanguageTypeScriptMIT LicenseMIT

Getting Started with Graphql + React + Apollo

I try to demostrate context + hoc in different use cases.

I use Material UI with Formik and Apollo Client.

You can see all the organizations, update any organization, add new organization, and delete organization.

Context is used in the organization/list.tsx useOrganization

  • Global shared state.
  • When you want to share data between all nested components.

HOC is used in the organization/add.tsx withOrganizations

  • When you don't want to share data with all nested children.
  • When you want to pick the component which receives the props.
  • It will act as local storage for the specific component.

References

how-to-use-react-context-effectively

a-simple-graphql-example-with-relationships/

Screenshot

alt text