如何将数组作为属性传递给组件。以下两个均达 不到我想要的功能。我想通过项目数组, 在组件中进行操作并在render方法中输出。
<List columns=['one', 'two', 'three', 'four'] /> // unexpected token <List columns="['one', 'two', 'three', 'four']" /> // passed through as string not array
这种事情是否有标准的语法或最佳实践?
您需要使用{}js表达式:
{}
<List columns={['one', 'two', 'three', 'four']} />