The project that taught me React was Poem Sansar, a social platform where poetry enthusiasts post, share, and explore poems. I did not learn React from a course. I learned it because a real project kept asking questions the tutorials never covered, and this post is the beginner guide I wish I had read first.

Think in components

The mental shift that makes React click is this: stop thinking in pages and start thinking in components. A page is just components nested inside components. My poetry feed was not one big file. It was a PoemCard inside a PoemFeed inside an App, and each one had exactly one job. When something looked wrong, I knew exactly which small box to open.

Start every feature by sketching boxes on paper. Draw the card, the feed, the header. Then each box becomes a component. This habit will save you more time than any library.

Props in, UI out

A component is a function that takes props and returns UI. The poem card below receives a poem object and renders it. Nothing more. Because it only depends on its props, I could reuse the same card in the main feed, on profile pages, and in search results without changing a line:

function PoemCard({ poem }) {
  return (
    <article className="poem-card">
      <h3>{poem.title}</h3>
      <p className="poem-author">by {poem.author}</p>
      <p className="poem-text">{poem.body}</p>
      <div className="poem-meta">
        <span>{poem.likes} likes</span>
        <span>{poem.comments} comments</span>
      </div>
    </article>
  );
}

Notice there is no data fetching here and no global state. The card is dumb on purpose. Smart components fetch, dumb components render. Keep that separation and your app stays understandable as it grows.

State is a snapshot

The idea that confused me longest was state. It finally clicked when I stopped thinking of it as a variable and started thinking of it as a snapshot: every render is a photograph of your state at one moment. Here is the like button from a poem card:

function LikeButton({ initialLikes }) {
  const [likes, setLikes] = useState(initialLikes);
  const [liked, setLiked] = useState(false);

  function toggleLike() {
    setLiked(!liked);
    setLikes(liked ? likes - 1 : likes + 1);
  }

  return (
    <button onClick={toggleLike} className={liked ? "liked" : ""}>
      {liked ? "♥" : "♡"} {likes}
    </button>
  );
}

Two rules cover most beginner bugs. First, never mutate state directly; always call the setter so React knows to re-render. Second, keep state as low in the tree as possible. The liked status lives in the button, not in the whole app, because nothing else needs to know about it.

Fetch data in one place

My first version let every component fetch its own data, which meant the feed, the sidebar, and the profile page each fired off requests and each handled loading and error states differently. The fix was to fetch once, high in the tree, and pass the data down as props:

function PoemFeed() {
  const [poems, setPoems] = useState([]);
  const [loading, setLoading] = useState(true);

  useEffect(() => {
    fetch("/api/poems")
      .then((res) => res.json())
      .then((data) => {
        setPoems(data);
        setLoading(false);
      })
      .catch(() => setLoading(false));
  }, []);

  if (loading) return <p>Loading poems...</p>

  return (
    <div>
      {poems.map((poem) => (
        <PoemCard key={poem.id} poem={poem} />
      ))}
    </div>
  );
}

A few things worth noticing. The empty dependency array means the effect runs once, like a componentDidMount for function components. The key prop helps React track list items efficiently, and it must be stable and unique, which is why database ids are perfect for it. And the loading state is handled in exactly one place instead of being reinvented in every component.

What I would do differently

Looking back at Poem Sansar, I would fetch data in fewer places and pass it down instead of letting every component fetch its own. I would also name things better from day one: data, info, and temp are names that rot. But the biggest lesson is simpler than any of that. React rewards you for building the smallest thing that works and then composing upward. Start with the card, then the feed, then the app. The framework meets you halfway if you let it.