0

i am new to the react-native and i am using Atom GUI 1.12.6 on windows 7 and Exponent for deploying app in android phone this was my code

'use strict';

import Exponent from 'exponent';
import React, {Component} from 'react';

import { AppRegistry, Text } from 'react-native';

class App extends Component{
    constructor(props, context) {
        super(props, context);
        this.state = {
        };
    }

    render(){}
      return (
          <Text>Hello world again!</Text>
      );
   }
}
Exponent.registerRootComponent(App);

.eslintrc file contains rules :

{
    "extends": "airbnb/base",
    "plugins": [
        "react"
    ],
    "env": {
        "node": true,
        "jasmine": true,
    },
    "rules": {
        "indent": [1, 4],
        "no-console": 0,
        "no-unused-vars": [1, {"vars": "local", "args": "none"}],
        "react/forbid-prop-types": 1,
        "react/jsx-boolean-value": 1,
        "react/jsx-closing-bracket-location": 1,
        "react/jsx-curly-spacing": 1,
        "react/jsx-indent-props": 1,
        "react/jsx-key": 1,
        "react/jsx-max-props-per-line": 1,
        "react/jsx-no-duplicate-props": 1,
        "react/jsx-no-undef": 1,
        "react/jsx-quotes": 1,
        "react/jsx-sort-prop-types": 1,
        "react/jsx-sort-props": 1,
        "react/jsx-uses-react": 1,
        "react/jsx-uses-vars": 1,
        "react/no-danger": 1,
        "react/no-did-mount-set-state": 1,
        "react/no-did-update-set-state": 1,
        "react/no-direct-mutation-state": 1,
        "react/no-multi-comp": 1,
        "react/no-set-state": 1,
        "react/no-unknown-property": 1,
        "react/prefer-es6-class": 1,
        "react/prop-types": 1,
        "react/react-in-jsx-scope": 1,
        "react/require-extension": 1,
        "react/self-closing-comp": 1,
        "react/sort-comp": 1,
        "react/wrap-multilines": 1,
        "id-length": 0,
    },
    "ecmaFeatures": {
      "jsx": true
    },
}

Getting error : in Atom Editor on Text control it is showing "Parsing error: Unexpected token <" if you ignore that and start deploy in the android phone using exponent in phone it showing red screen with error :"Unexpected token '<'"

1 Answer 1

3

Your have a typo in the render method..

render(){}

Change to:

render() {
    return (
        <Text>Hello world again!</Text>
    );
}
Sign up to request clarification or add additional context in comments.

2 Comments

Thanks now i am able to deploy the app in the phone, but in Atom Editor on Text control it is showing "Parsing error: Unexpected token <" how to solve this ?
I'm not familiar with Atom, but you might be using wrong Atom syntax highlight that doesn't recognize react..or eslint is not configured well.. See react Atom plugin and configure eslint for react in Atom

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.