I know its possible to ADD and DELETE a file through the context API, but how would you edit one?
For example: This is the DELETE function with Global Context
case "DELETE_TRANSACTION":
return {
...state,
transactions: state.transactions.filter(
(transaction) => transaction.id !== action.payload
),
};
or in this ADD function example:
case "ADD_TRANSACTION":
return {
...state,
transactions: [action.payload, ...state.transactions],
};
What would the edit function be?