一个错误Unexpected token, expected }
突然出现没有明确的原因。
第136:7行就是主人所说的:{
const styles = StyleSheet.create({
master: {
flex: 1,
justifyContent: 'center',
flexDirection: 'row',
alignItems: 'center',
flexWrap: 'wrap'
}
});
之前工作正常。我试过了:
rm -rf node_modules && npm install
npm start -- --reset-cache
其中任何一个都没有变化。
此错误是由于我的渲染方法中缺少</>
。
在我的情况下错误是
意外的令牌,预期“,”
。原因是在样式表中,使用=代替:
color = colors.white
而不是color: colors.white
就我而言,ComponentDidUpdate
是在render()
方法之后。