i am import external js file and call funcation in component but getting error "get i use this code but showing undefined is not an object (evaluating _ApiHelper.ApiHelper.getPost)"
Main login file code
import React, { Component } from "react";
import Icon from "react-native-vector-icons/Ionicons";
import {
View,
StyleSheet,
Image,
TextInput,
TouchableOpacity,
Text,
Alert,
KeyboardAvoidingView
} from "react-native";
//
import { Search } from '../Search/Search';
import { ApiHelper } from '../../api/ApiHelper';
export default class Login extends Component {
static navigationOptions =
{
title: 'LoginActivity',
};
constructor(props) {
super(props);
//
//Obj = new ApiHelper();
//
this.state = {
userName: '',
password: '',
serverName:''
}
}
UserRegistrationFunction = () =>{
const { userName } = this.state ;
const { password } = this.state ;
const { serverName } = this.state ;
this.data = {
name: userName,
email: password,
password: serverName
}
alert(ApiHelper.getPost());
//Alert.alert(returndata);
}
Import file code
const ApiHelper = {
getPost:() => {
return 1;
}
}
export default ApiHelper;
what wrong in my code i also clear react native cache and other stuff. thank in advance.
getdata, which is not shown here in your code.