Adjusting the CreatePost component

Finally, we are going to adjust the CreatePost component by following these steps:

  1. Edit src/post/CreatePost.js and adjust the import statement to also import the useAPICreatePost Hook:
import { useUserState, useDispatch, useAPICreatePost } from '../hooks'
  1. Then, replace the current Resource Hook with the following:
    const [ post, createPost ] = useAPICreatePost()

Now the CreatePost component uses our custom API Hook to create new posts via the API.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
18.188.142.146