May 2018
Intermediate to advanced
470 pages
13h 54m
English
The Users component in client/user/Users.js, shows the names of all the users fetched from the database, and links each name to the user profile. This component can be viewed by any visitor to the application and will render at the path '/users':

In the component definition, we first initialize the state with an empty array of users.
mern-skeleton/client/user/Users.js:
class Users extends Component { state = { users: [] }...
Next, in componentDidMount, we use the list method from the api-user.js helper methods, to fetch the user list from the backend, and load the user data into the component by updating the state.
mern-skeleton/client/user/Users.js ...
Read now
Unlock full access