如果params不给props赋值的话,props可以显示所有参数,给props赋值后只能从params里面取,有其它方法可以接收剩余参数吗?这些剩余参数都是不固定的,比如我想取到传过来的date属性值
interface params = {
count: number,
}
const ChildComp: React.FC<any> = (props:params) => {...}
...
const ParentComp = () => {
const [count,setCount] = useState(0);
useEffect(() => {
console.log(count);
}, [count]);
return (
<ChildComp count={count} date='20211210' />
)
}
interface params = {
count: number,
}
const ChildComp: React.FC<any> = (props:params) => {,
return (
<div>{props.count}</div>
)
}
export default ChildComp;
是这个意思?