我想用3个输入调用一个函数。其中2个是数字,一个是字符串。这两个数字进一步传递了,但这不是问题。我希望将字符串打印在元素中。
我相信这是将参数传递给代码的html部分的问题,但我不知道该怎么做。
import Typography from '@material-ui/core/Typography';
export function myfunction(name, min max){
const midpoint = Math.ceil((min + max)/2)
return(
<div>
<Typography id="input-slider">
name //this is where I want name to be
</Typography>
<div/>
)
}
在第二个文件中,我称之为]
function main(){
return(
<div>
{myfunction(MYNAME, 0, 10)
<div/>
)
}
我想用3个输入调用一个函数。其中2个是数字,一个是字符串。这两个数字进一步传递了,但这不是问题。我希望将字符串打印在元素中。我...
我相信为了在要使用的html标记内传递参数,请使用模板文字。所以你的代码看起来像