DEV Community

Discussion on: Learn React Hook by building a Simple Blog App

Collapse
kmert10 profile image
Mert Karakas

Great article. Just some feedback, there are some typos with your code and your descriptions. One example is:

const [allPosts, setAllPosts] = useState([]);

After that, we'll create a new function called savePost:
const savePost = () => {
    const id = Date.now();
    setAllPost([...allPost, {title, content, id}]);
    console.log(allPost);
  };
Enter fullscreen mode Exit fullscreen mode