I am receiving data from server as json data but not a able to display it on the browser i am getting error as
\" Objects are not valid as a React child
The error suggests that this.state.post.data is an object and hence you need to convert it to a string before rendering. Use JSON.stringify()
Try
class Student extends React.Component{
constructor(props){
super(props);
this.state={
post:[]
}
};
componentDidMount(){
axios.get('http://localhost:8080/student')
.then(data => this.setState({post:data}));
}
render(){
return(
{JSON.stringify(this.state.post.data)}
);
}
}