Hello juniors, what have you been learning these past few weeks? What do you need help with?

Let the whole community know what you have been working on lately, where you are having problems and need help. Let the whole community help you figure stuff out.

2 Likes

I am currently learning reactjs am quite comfortable with the context api. Now with the useReducer().and the dispatch function.
I followed a tutorial but I tried using then I realised I don’t understand it…my question is why would you use a reducer in your state management?

I was building an online store using the context api. I got stuck at the point when a user clicks, an individual it should take you to that single items page

Reducers are pure functions, they take your current state and an action and hopefully you get some state returned to you.

Sometimes you need to take a step back from the tutorials and read some docs/articles that explain the concepts.

That being said, Reducers act as a reducer(something like the .reduce()) method in JS. Anytime redux runs, it calls your reducer function with your current/previous state and current action (state, action). The next state is then deduced/calculated based on the action passed and then returned.

2 Likes

Oh okay so if I understand it, it takes your current state and updates it based on a action which has been dispatched and returns that updated state.

Something like that.

1 Like

learning laravel and Vue js building edwuma.work. I’m struggling to integrate a payment system.

Payments is our collective pain. Which one are you using?

right now. I’m thinking of using epay but I’ve less experience and don’t really understand api’s yet. so taking my time to make the platform work well. but I was able to follow a tutorial and integrate stripe which worked fine unfortunately couldn’t find any for the ghana ecosystem especially making payments over mobile money.

Coolio, dont forget to create a topic when you hit a wall.

+1 on the part about docs. Tutorials are good for getting a hang of how it all ties into an app. I recently was reading up on redux from the docs at reduxjs.org and I wish I had started earllier.

For more understanding of redux and the whole reducer state management pattern check out some talks on Functional programming on YouTube. It seems to be catching on (again) especially with JavaScript developers.