adrianhajdin / project_mern_memories

This is a code repository for the corresponding video tutorial. Using React, Node.js, Express & MongoDB you'll learn how to build a Full Stack MERN Application - from start to finish. The App is called "Memories" and it is a simple social media app that allows users to post interesting events that happened in their lives.
https://youtube.com/playlist?list=PL6QREj8te1P7VSwhrMf3D3Xt4V6_SRkhu
4.96k stars 1.83k forks source link

React 18.2 -- src/reducers/posts.js Line 1:1: Assign arrow function to a variable before exporting as module default #144

Open cleankicks11 opened 1 year ago

cleankicks11 commented 1 year ago

Im getting the error that /src/reducers/posts.js - cannot export or use anonymous function.

Can you please offer updated React 18 support or put out resources of how to change/port the changes?

Is there an update for the arrow functions for the react 18 version?

export default (posts = [], action) => { switch (action.type) { case 'FETCH_ALL': return action.payload; case 'CREATE': return posts; default: return posts; } };