/    Sign up×
Community /Pin to ProfileBookmark

How should the data be fetched from db within react?

Have I understand this correct?

Lets say the website has a list of users which I can delete or add a new user

If I had no back-end, this is what it would look like, correct?

  • 1. The users is saved in redux with its info

  • 2. User getting deleted: I delete that specific user from redux

  • 3. Adding a new user: I insert a new user with its info in redux
  • But how does the flow work with a backend(nodejs/express in this case)?
    Maybe like this?:

  • 1. I visit the website(the website starts). and now I fetch all the users from the DB and then inserts them all in redux where I fetch the data with react to be able to show it on the page

  • 2. User getting deleted: I delete the user from the DB AND from redux(or should nothing be done in redux in this case, since redux is going to get updated the second I delete the user from the db, or how does this work?)

  • 3. Adding a new user: same goes here as for nr 2
  • to post a comment
    JavaScript

    3 Comments(s)

    Copy linkTweet thisAlerts:
    @bbq1authorMar 22.2019 — Bump
    Copy linkTweet thisAlerts:
    @rootMar 23.2019 — This sit is for code problems, not advice on issues that are hypothetical.


    *closed*
    Copy linkTweet thisAlerts:
    @rootMar 23.2019 — {"locked":true}
    ×

    Success!

    Help @bbq1 spread the word by sharing this article on Twitter...

    Tweet This
    Sign in
    Forgot password?
    Sign in with TwitchSign in with GithubCreate Account
    about: ({
    version: 0.1.9 BETA 4.23,
    whats_new: community page,
    up_next: more Davinci•003 tasks,
    coming_soon: events calendar,
    social: @webDeveloperHQ
    });

    legal: ({
    terms: of use,
    privacy: policy
    });
    changelog: (
    version: 0.1.9,
    notes: added community page

    version: 0.1.8,
    notes: added Davinci•003

    version: 0.1.7,
    notes: upvote answers to bounties

    version: 0.1.6,
    notes: article editor refresh
    )...
    recent_tips: (
    tipper: @Yussuf4331,
    tipped: article
    amount: 1000 SATS,

    tipper: @darkwebsites540,
    tipped: article
    amount: 10 SATS,

    tipper: @Samric24,
    tipped: article
    amount: 1000 SATS,
    )...