简体   繁体   English

如何解决 reactjs 中的过载错误

[英]how to resolve overload errors in reactjs

import React from 'react'
import { Link } from 'react-scroll'
import "./Protocol.css"
import { ANALYTICS, TRADE, USERS, TRADERS, VOTES, ZEROES } from "../../Constants"
const Protocol = () => {
    return (
        <div className="Protocol_container">
            <div className="Protocol_heading">
                {ANALYTICS}
            </div>
            <div className="Protocol_content">
                <Link>
                    <p>{ZEROES}</p>{TRADE}
                </Link>
                <Link >
                    <p>{ZEROES}</p>{USERS}
                </Link>
                <Link >
                    <p>{ZEROES}</p>{TRADERS}
                </Link>
                <Link>
                    <p>{ZEROES}</p>{VOTES}
                </Link>
            </div>

        </div>
    )
}
export default Protocol

getting err as变得错误

No overload matches this call.没有重载匹配这个调用。 Overload 1 of 2, '(props: LinkProps | Readonly): Link', gave the following error.重载 1 of 2, '(props: LinkProps | Readonly): Link',出现以下错误。 Property 'to' is missing in type '{ children: (string | Element)[];类型 '{children: (string | Element)[]; 中缺少属性 'to' }' but required in type 'Readonly'. }' 但在'只读'类型中是必需的。 Overload 2 of 2, '(props: LinkProps, context: any): Link', gave the following error.重载 2 of 2, '(props: LinkProps, context: any): Link',出现以下错误。 Property 'to' is missing in type '{ children: (string | Element)[];类型 '{children: (string | Element)[]; 中缺少属性 'to' }' but required in type 'Readonly'. }' 但在'只读'类型中是必需的。

在此处输入图片说明

链接需要道具到=“去哪里”,如果你不想去任何地方就使用to=“#”

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM