Javascript 反应<;链接>;按钮不是我声明的淋浴文本

Javascript 反应<;链接>;按钮不是我声明的淋浴文本,javascript,html,reactjs,Javascript,Html,Reactjs,目前,我面临的问题是,我编写了一个单词来显示在我的HTML网页上,但它没有显示出来。 但是,如果我在我的web浏览器上使用inspect并手动输入“注册”,它就可以出现在主页上 从“React”导入React,{useState} 从“react router dom”导入{Link} 从'react icons/md'导入{MdFingerprint} 从'react icons/fa'导入{fabar,FaTimes} 从“./Button”导入{Button} 函数Navbar(){ c

目前,我面临的问题是,我编写了一个单词来显示在我的HTML网页上,但它没有显示出来。 但是,如果我在我的web浏览器上使用inspect并手动输入“注册”,它就可以出现在主页上


从“React”导入React,{useState}
从“react router dom”导入{Link}
从'react icons/md'导入{MdFingerprint}
从'react icons/fa'导入{fabar,FaTimes}
从“./Button”导入{Button}
函数Navbar(){
const[click,setClick]=useState(false);
常量[按钮,设置按钮]=使用状态(真)
const handleClick=()=>setClick(!click);
//const closeMobileMenu=()=>setClick(false)
常量showButton=()=>{
如果(window.innerWidth{
常量checkButtonStyle=样式。包括(buttonStyle)?buttonStyle:样式[0]
const checkButtonSize=样式。包括(buttonSize)?buttonSize:大小[0]
常量checkButtonColor=样式。包括(buttonColor)?buttonColor:颜色[0]
返回(
{讲师}
)
}

好吧,您接受内部的
按钮
文本作为
讲师
的道具名称,因此根据您的
组件,您需要像这样将其字符串传递给它:


注意:您可以阅读有关道具和组件的更多信息

import React from 'react'
import './Button.css';

const STYLES= ['btn--primary', 'btn--outline']

const SIZES = ['btn--medium', 'btn--large', 'btn--mobile', 'btn--wide']

const COLOR = ['primary', 'blue', 'red', 'white']

export const Button = ({lecturer, type, onClick, buttonStyle, buttonSize,buttonColor}) =>{

    const checkButtonStyle=STYLES.includes(buttonStyle)? buttonStyle :STYLES[0]
    const checkButtonSize=STYLES.includes(buttonSize)? buttonSize :SIZES[0]
    const checkButtonColor=STYLES.includes(buttonColor)? buttonColor :COLOR[0]

    return (
        <button className={`btn ${checkButtonStyle} ${checkButtonSize} ${checkButtonColor} `  } onClick={onClick} type={type}>{lecturer}</button>
    )

}