React Error: Rendered more hooks than during the previous render. when using useState and map

Solution 1:

You cannot assign a React component like that inside a map

{posts.map((post) => <PostDisplay post={post}/>)}

iterate through the array and pass the value as prop to the component.

const PostDisplay = ({post}) => {

  const [try, setTry] = useState("")

  return (
    <div>Hello </div>
  );


}