我正在开发一个项目,该项目创建即时贴效果并且在应用上运行npm run start:dev
时无法编译
import React from 'react';
import Cards, { Card } from 'react-swipe-card'
const data = ['Alexandre', 'Thomas', 'Lucien']
const SwipeCard = () => (
return (
<Cards onEnd={action('end')} className='master-root'>
{data.map(item =>
<Card
onSwipeLeft={action('swipe left')}
onSwipeRight={action('swipe right')}>
<h2>{item}</h2>
</Card>
)}
</Cards>
)
);
export default SwipeCard;
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/react/15.1.0/react-dom.min.js"></script>
可以找到here
答案 0 :(得分:0)
您正在为带有隐式返回的def BLFRepair(filename_in, filename_out):
""" Repairs a corrupted Vector .blf fileself.
Args:
filename_in (str): Filename of input corrupted file.
filename_out (str): Filename to save repaired file with.
"""
cleaned_log=BLFReader(filename_in) # ignores errors
logger=BLFWriter(filename_out)
for msg in cleaned_log:
logger.on_message_received(msg)
logger.stop()
组件使用不带主体的箭头功能,因此您只需删除SwipeCard
语句即可。
return
答案 1 :(得分:0)
如@Tholle所述,您只需删除return语句即可。另外,您可以将外部(
和)
更改为{
和}
,如下所示以表示功能。通常,我这样做是为了使我所有的箭头功能都具有一致的格式。
import React from 'react';
import Cards, { Card } from 'react-swipe-card'
const data = ['Alexandre', 'Thomas', 'Lucien']
const SwipeCard = () => {
return (
<Cards onEnd={action('end')} className='master-root'>
{data.map(item =>
<Card
onSwipeLeft={action('swipe left')}
onSwipeRight={action('swipe right')}>
<h2>{item}</h2>
</Card>
)}
</Cards>
)
};
export default SwipeCard;