score:0

Accepted answer
import React, { useContext, useEffect, useState } from "react";
import { BlogDataContext } from "../contexts/BlogDataContext";

export default function BlogPage({ match }) {
  var Id = match.params.id;
  const context = useContext(BlogDataContext);
  const [Blog, setBlog] = useState();
  useEffect(() => {
    var data = context.filter((b) => {
      return b._id === Id;
    });
    console.log(data);
    setBlog(data);
  }, [context]);
  return (
    <div style={{ color: "red" }} className="BlogPage">
      hello
    </div>
  );
}

Related Query

More Query from same tag