I have been trying to fetch some values from my spring boot localhost restapi. It is throwing a network error. I have tried to fetch with Axios.get() too but no result.I have given CORS(origins='*') in my springboot class and method too.
async componentDidMount()
{
const response = await fetch('http://localhost:8080/jobSeeker/allJobSeekers');
const body = await response.json();
this.setState({ users: body, isLoading: false });
console.log(users);
}
[Unhandled promise rejection: TypeError: Network request failed]
- node_modules\react-native\Libraries\vendor\core\whatwg-fetch.js:504:29 in onerror
- node_modules\event-target-shim\lib\event-target.js:172:43 in dispatchEvent
- ... 8 more stack frames from framework internals