Below is the code for my action creator:
export function fetchPosts()
{
const request = axios.get(`${ROOT_URL}/posts${API_KEY}`);
return
{
When you replace , with ; you get an error because, as stated by your error message, an action must return a JavaScript object.
In JavaScript object properties should be separated by , as:
return
{
type: FETCH_POSTS, // use comma here
payload: request
};
In this way the return statement will return a new object with two properties type and payload.