Message from JavaScript discussions

September 2020

— I would build own hook


First lemme tell you wt I did...
Initially, I set up the redux but after sometime I realized that I don't need a central state....then I kinda tried to emulate the Angular's service approach.

— I created a folder called services and then ...there I created files like user.js, roles.js...etc

— It is like

export const getAllUsers = () => {

const res = api.get('/users');


Message permanent page

— Then in the component it's like...

import {getAllusers} from '../services/.users.js';

const data = await getAllUsers();

Message permanent page

— But this try catch bull is over the place.

— Is it a good approach or do I need to do something else?

— How are you using await there?

— It returns a promise.

— It's an async function

— Promise would be cleaner here

— Wt do u mean by tht?