{
"plugins": [
["babel-plugin-x-for"],
]
}
<div key={item} x-for={item in arr}>
hello world
</div>
{
Array.isArray(arr) &&
arr.map(item => {
return <div key={item}> hello world</div>;
});
}
<div key={index} x-for={(item, index) in arr}>
hello world
</div>
{
Array.isArray(arr) &&
arr.map((item, index) => {
return <div key={index}> hello world</div>;
});
}
1、忽略 ts 报错