question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

DataStore hooks for react

See original GitHub issue

Feature Request

We need to create generic hooks for Datastore. Currently, we are looking at passing the model as input to CRUD hooks, like this useAdd(model) or useDataStoreAdd(model)

@wtrocki @kingsleyzissou

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:15 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
Eunovocommented, Jul 31, 2020

@wtrocki I will start plain hooks

1reaction
wtrockicommented, Jul 31, 2020

I think we should go with the first approach:

We need both. Lazy query is needed when you have conditionals etc. We can start with first one though. I think apollo has this concept of lazy query it has called flag returned by hook called boolean A boolean indicating if the query function has been called, used by useLazyQuery (not set for useQuery / Query). https://www.apollographql.com/docs/react/data/queries/

Read more comments on GitHub >

github_iconTop Results From Across the Web

React - using Datastore Hooks - Offix
Offix Datastore provides react hooks for CRUD operations and subscription. For a quick start see sample react app.
Read more >
Simplify querying the Amplify DataStore using React hooks
React hook to read from the [Amplify DataStore](https://docs.amplify.aws/lib/datastore/getting-started/q/platform/js). * Built-in supports for real-time ...
Read more >
Use React Hooks with Storage as Global State Management
With hooks, we can use state and other React features without writing a class. With useEffect , we can run some function as...
Read more >
How to Use localStorage with React Hooks to Set and Get Items
Hooks allow React developers to use state and lifecycle methods within functional components. They also operate with existing code, making them ...
Read more >
Using React Hooks for state management - LogRocket Blog
Using the useReducer Hook for state management in React enables you to share state between components without Redux.
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found