添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
文质彬彬的草稿纸  ·  python dataframe ...·  7 月前    · 
低调的梨子  ·  IntelliJ ...·  1 年前    · 
满身肌肉的火柴  ·  求助,关于java8 ...·  1 年前    · 
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

Fetching news headlines from an API and showing 10 news per page and theirs id's. which also refreshes in 10 seconds and new headlines come. With pressing detail button we see details. Struggling to pass prop from one component using this code:

export interface InitPost {
  location: any;
  title: string;
  url: string;
  created_at: Date;
  author: string;
const [posts, setPosts] = useState<InitPost[]>([]);
  const getDetails = (post: InitPost) => {
    navigate("/details", { state: post });

props passed to Details component here is the code: with error "Module '"react-router-dom"' has no exported member 'RouteComponentProps." what am I doing wrong?

import React from "react";
import { RouteComponentProps } from "react-router-dom";
import { InitPost } from "./Home";
const Details: React.FC = (
  props: RouteComponentProps<{}, any, InitPost | any>
) => {
  const post = props.location.state;
  return (
      <pre>{JSON.stringify(post, null, 2)}</pre>
export default Details;
                Are you using react-router v6?. If so, RouteComponentProps is not available on that version
– Alejandro Barone
                Apr 19, 2022 at 15:51
        

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.