AdvancedReactNative
AdvancedReactNative copied to clipboard
Super expression must either be null or a function, not undefined
Hey, I am getting the following error
Super expression must either be null or a function, not undefined
App.js
import React, { Component } from 'react'; import { StyleSheet, Text, View } from 'react-native';
import Ball from './src/Ball';
export default class App extends Component { render() { return ( <View style={styles.container}> <Ball />
</View>
);
} }
const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: '#fff', alignItems: 'center', justifyContent: 'center', }, });
Ball.js
import React, { Component } from 'react-native'; import { View } from 'react-native';
export default class Ball extends Component{ render(){ return( <View style={styles.ball} /> ); } }
const styles = { ball: { height: 60, width: 60, borderRadius: 30, borderWidth: 30, borderColor: 'black' } };
when i had those it was due to spelling issue, make sure component and text are camel cased (Component, Text etc)
@DavidAames It is clearly because of your declaration on Ball.js
import React from 'react'; and not import React from 'react-native';
Could be caused by a circular dependency. Similar error and response from @ljharb on this issue
That usually happens when you're extending something that's a circular dependency. I'd recommend updating enzyme first, before upgrading React - that way you'll know for sure which thing caused the breakage.
when i had those it was due to spelling issue, make sure component and text are camel cased (Component, Text etc)
Saved me an hour!!, Thanks.