Fetch get timeout using React and Rails backend



I build an application with React and Rails. I can use previews to view both of them running. But when I tried to connect Rails and React, get data from Rails backend using fetch function. It gives me timeout. I followed the instruction of setting preview url to public ip but seems not solving my problem. Anyone have the same issue? Please help me out. Thank you
componentDidMount() {
fetch(“”).then((response) => {
if (response.ok) {
return response.json();
} else {
throw new Error(‘Something went wrong’);
nextstops => this.setState({nextstops})
.catch((error) => {