当用户单击react中的handleClick函数时,我想呈现infoPage.js。感谢帮助?
infoPage.js
import React from 'react'
export default function infoPage() {
return (
<div>
<h1> this is info components</h1>
</div>
)
}
App.js:
<button className="btn btn-primary" onClick={handleClick}>{value.title}</button>
功能:
const handleClick = () => {
const url = infoPage;
window.open(url, '_blank');
}
如果您想在新窗口中显示/infoPage
,请尝试此代码,它是有效的。!
const handleClick = () => {
window.open('/infoPage', '_blank', 'location=yes,height=570,width=520,scrollbars=yes,status=yes');
}