我在将展开运算符道具传递给组件时遇到问题。它不是返回一个包含值的列表,而是返回一个空列表。
这就是我将 props 传递给组件的方式
const APIKey = "abc";
const url = "def";
const props = { APIKey, url}
return (
<ProfileModal {...props} />
)
Run Code Online (Sandbox Code Playgroud)
但是,它返回一个空列表。
const FunctionName = (anotherPropIhave, props) => {
const { APIKey, url } = props;
}
Run Code Online (Sandbox Code Playgroud)