I am using ReactJs. I have two Components,PrescriptionIndex and PrescriptionNew, integrating one with another.
This is my first component \'PrescriptionNew\'
The reason is pretty straight forwards, you have an if-else and you are returning from both of them so the last part of your code is unreachable
you might want this
import React , { Component } from 'react';
import { connect } from "react-redux";
import { fetchPrescriptionFromUrl } from '../actions/index.js';
import { Link } from 'react-router';
import PrescriptionNew from './new.jsx';
import '../app.css';
class PrescriptionIndex extends Component {
componentDidMount(){
this.props.fetchData(PORT+'/prescriptions');
}
render() {
if (this.props.has_error){
return( Fetching an Api results in error
)
}
if (this.props.has_loading){
return( Loading...
)
}
return(
{this.props.prescriptions.prescriptions && this.props.prescriptions.prescriptions.map(function(data){
return (
);
}); }
)
}
}
export default PrescriptionIndex;