Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Involving Database #640

Closed
RefiPeretz opened this issue Jan 4, 2020 · 4 comments
Closed

Involving Database #640

RefiPeretz opened this issue Jan 4, 2020 · 4 comments

Comments

@RefiPeretz
Copy link

Hey it was great if you could involve database in this example.
I'm following your course on Pluralsight and it's not clear to me where I should put database update If I would like to persist my store.

At first I thought it should be in the reducers but you said we should keep it pure and use only for states updates.
I'm a newbie in react.

@coryhouse
Copy link
Owner

A database would traditionally be handled on the server, and accessed via HTTP calls to an API that's hosted on the server and calls the DB. You can store data on the client via localStorage, but you probably want a real database. Since a database is a server-side concern, it's deliberately left out of Slingshot.

@RefiPeretz
Copy link
Author

RefiPeretz commented Jan 4, 2020

K make sense.
So this a pure question if you may. Where an API call for DB updating should be located in the Redux model. Should I just make it in the component? how are we involving the state? I saw some examples regarding any connection with a backend, where the sate only manage call status.

I would like to hear your opinion on what is the best practice.

Anyway amazing course cheers.

@coryhouse
Copy link
Owner

API calls are traditionally made from your actions, using Redux-thunk or an alternative middleware.

@coryhouse
Copy link
Owner

And thanks for the kind feedback!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants