我已经在我的主文件中声明了一个地图。我有另一个文件测试,我想将我的地图传递给它。下面是我的 Main.tsx 文件
const [testMap] = useState(new Map<string,PersonInfo|undefined>());
<Test list={testMap}/> //This is my Main.tsx file
下面是我的 Test.tsx 文件的代码
interface Temp {
list:Map<string,PersonInfo|undefined>;
}
export default (
{list}:Temp
) => {
return (
<>
<p>
//Here i want to display the size of my map
</p>
</>
);
};
我想显示我作为参数传递的地图的大小,但我无法这样做。我该如何解决这个问题?