2021-12-20
3652
#react
Ovie Okeh
11051
Dec 20, 2021 â‹… 13 min read

Using Contentful with React

Ovie Okeh Programming enthusiast, lover of all things that go beep.

Recent posts:

Exploring Nushell, A Rust Powered, Cross Platform Shell

Exploring Nushell, a Rust-powered, cross-platform shell

Nushell is a modern, performant, extensible shell built with Rust. Explore its pros, cons, and how to install and get started with it.

Oduah Chigozie
Apr 23, 2024 â‹… 6 min read
Exploring Zed, A Newly Open Source Code Editor Written In Rust

Exploring Zed, an open source code editor written in Rust

The Zed code editor sets itself apart with its lightning-fast performance and cutting-edge collaborative features.

Nefe Emadamerho-Atori
Apr 22, 2024 â‹… 7 min read
Implementing Infinite Scroll In Next Js With Server Actions

Implementing infinite scroll in Next.js with Server Actions

Infinite scrolling in Next.js no longer requires external libraries — Server Actions let us fetch initial data directly on the server.

Rahul Chhodde
Apr 19, 2024 â‹… 10 min read
Integrating Django Templates With React For Dynamic Webpages

Integrating Django templates with React for dynamic webpages

Create a dynamic demo blog site using Django and React to demonstrate Django’s server-side functionalities and React’s interactive UI.

Kayode Adeniyi
Apr 18, 2024 â‹… 7 min read
View all posts

4 Replies to "Using Contentful with React"

  1. Noob question: Does a developer need a CMS? I didn’t think about one, but then I realized that managing a hundred posts, which each post having on average 5 iages, becomes quite painful.

  2. Hi Ovie, I’ve followed your tutorial however when the user clicks on an individual post the SinglePost component renders in an endless loop. Any ideas? Cheers.

  3. Anyone stumbling upon this article and getting infinite loops in the Network tab you need to change the useEffect slightly:

    export default function useSinglePost(slug) {
    const [post, setPost] = useState(null);
    const [isLoading, setLoading] = useState(true);
    useEffect(() => {
    getSinglePost(slug)
    .then(result => {
    setPost(result[0].fields);
    setLoading(false);
    });
    }, [slug]);
    return [post, isLoading];
    }

Leave a Reply