October 2019
Intermediate to advanced
426 pages
11h 49m
English
First, we refactor the user components, and then we move on to the post components.
Let's refactor the user-related components now:
export default function UserBar ({ user, dispatch }) { if (user) { return <Logout user={user} dispatch={dispatch} /> } else { return ( <React.Fragment> <Login dispatch={dispatch} /> <Register dispatch={dispatch} /> </React.Fragment> ) }}
import React, { useContext } from 'react'Read now
Unlock full access