-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Backend context and reducer #4
base: Main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code looks good. Just the ContextProducts.jsx
looks confusing as it has reducer too unlike other context files and ReducerProducts.jsx
does not have reducer in it. You can remove console.logs
if not needed.
@@ -0,0 +1,67 @@ | |||
import React, { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
suggestion - you can name this file similar to how you have named other context files so that naming looks consistent.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Try the suggested changes, rest looks good
|
||
const FilterReducer = ( | ||
state, | ||
{ type, payload } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
liked that you destructuring in parameters
var modal = | ||
document.getElementById("myModal"); | ||
|
||
// Get the button that opens the modal | ||
var btn = document.getElementById("myBtn"); | ||
|
||
// Get the <span> element that closes the modal | ||
var span = | ||
document.getElementsByClassName( | ||
"close" | ||
)[0]; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
you can instead build a custom hook like useCloseModal and use "useref" instead of doing vanilla js. this it will be much more useable.
Adding Backend context and reducer