0

I've been trying react-native development and i am in its first stage so I was trying to create a simple Hello World Application but the system keeps showing an error I cannot solve.

This is the result it shows.

My index.js file is as below:

   import {AppRegistry} from 'react-native';
import App from './App';
import {name as appName} from './app.json';

AppRegistry.registerComponent(appName, () => App);

and the main App.js file is as below

export default class App extends React.Component{
  render()
  return {(
    <View style={styles.container}>
    <Text style={styles.welcome}>
     Hello World!
   </Text>
    </View>
  );
}
};

i've fixed the babel and jest issues as well, any help is appreciated. Thank You.

1

1 Answer 1

1

In the render method the first curly bracket is in the wrong position, it should be after render() not after return:

export default class App extends React.Component{
  render() {
    return (
      <View style={styles.container}>
        <Text style={styles.welcome}>
          Hello World!
        </Text>
      </View>
    );
  }
};
Sign up to request clarification or add additional context in comments.

1 Comment

That doesnot seem to be the issue,I checked the tutorial and rewrote the code as you told,the error still exists.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.