In this React eCommerce website, we are going to learn how to create a code category filter in React JS. This will help us to categorize our products more effectively in our ecommerce website.
This code will allow us to limit the number of products shown on a given category page. We'll also cover how to create a simple-to-understand stateless component in React. This will make understanding and adapting the code to future projects much easier. So if you want to learn how to create a React eCommerce website, then keep watching – you won't regret it!
-------------- TIMILINE-------------- 0:00 Introduction 0:55 Subs Target 1:11 show Category Value UI 4:30 Add category value in state 5:30 Reducer fun. to Filter category wise
************* 😍 Must Watch Videos For Web Development 😍 *************
Hello what's up guys my name is Vinod
Badu Thapa Today we are going to see the
category filter in our React e-commerce website Yes
guys so yesterday you can see
The data you can see
here I have already
set it here We have got all our data Now
I have to show this data In the user interface like this And
then when I click on
I have to filter the products based on its
features So guys today it's really going to be
a lot of fun I would like you
to pause this video right now You will try it yourself
The search functionality of the category
Whenever you click
The product that is being filtered
Try it yourself
How can we do it
Whatever we have seen so far
At least you should know this much
Take some time
But do try Then you continue it Let's start the video without any delay
But before that guys again
thanks for the 5 lakh subscribers Now our next
target is 1 million
subscribers Keep moving forward
More awesome videos are
coming I am converting
it in my mind Thanks to all the member
support It means a
lot to me Alright It's very simple I am getting
all the data here
I need to return this data
Now I am removing the console
This is it
I am getting unique data
Now I am editing a new category
It is being filtered
We have
to run the loop
Because it's just a row of them
All my data is inside it
But in the heart of Essex the Carlisle Bracele
The world of
JavaScrip is like this
You will have to run the map method
It is very simple this way
I am walking here
Current Element
All you have to do is run the empty loop
Now I have to use the Ritten keywords here
And Riton has
a button for us
I would like to go down this button
I zoom in a bit less from Thogo because Babar
He is really doing it
What do we need to put in this button
You must pass the Bicos Map Matter
We are doing a job
A big project the
The index should not be done this way
Then it's a type
Whenever you press the button
They sell real estate
property
rest submit
button
put then
told me I had
Its name is very important
And the name that will be is yours to have
It means being the same
Welcome to the data category in API
He should be the same as he is
We were looking at the search part of the input field
Then you can see in this category I have not said "epic"
I have not mentioned the category in the filters
If I come to the bottom you will be able to see very carefully
We are still going to run that function
So the name is set and whenever anyone clicks on it
Then I will run this function
Perfect this is the function I will run now
Then the value inside it will be
It must be in the category of the one who is to be
This is the same category
The definition I have set here
And this is the same category
The thing I'm passing on to him about this
Then but if I run a perfection
Then that will be the value you understand
He is coming I'm
going to the top
And I pass by putting a comma in it
I needed
to be here Category
It's the same category
The things I am writing here
Now the next user has joined
Whoever is clicking on
Here we do it this way
If I seem to you then
event target value
I am getting that value
The user has ever
Clicking on a specific category
Name and the value it holds
I have passed the Eza payload to him
Inside whose
Here I
added him
I added simple dynamic
We did it this way simple
Adding
After
Whenever someone clicks on
It was necessary to run a filter on his base
So what did we say that
whenever our filters
Inside the state
any value of anyone that is in our filters
This dispatch will change
Basically both will leave
A second went by were already
there This is the filter product
We are sending this out
I will go here again filter underscore products
I have obtained the data
I found this here
Then whenever the
value of the category
changes I will have this functionality
It needs to be ru
How to look very simple is very easy
me filter products we know
it will be equal to time filter products
dot
We will have to run the filter method
It's simple if you ever want to filter
Then the filter method has already been provided
One thing I would like to mention is
You must be feeling it a lot
That I am about to filter
You must be thinking a lot
Hey how do I filter this
Here I will show you how to display data
Because what am I doing
Then I would like to tell you one thing
I'm getting this data right now Filal
Format of the array
And this one with JScript 16 hours
The video is very clear
You have a section here
when the array comes
You should first have the basics
which you should have
To filter the array inside
What does JavaScript provide us with
Who is providing the meths
Pick up all those meths
here and look at them
That which method to take
What kind of filtered data am I getting
And you will get the idea
You need to practice
In Filial you will see 90%
I always filter
You will receive your first current element
I will go here
I will give you a sib riton
Now this is my current element
The dot is its category
If it is triple equal to
My category of this kind of cat
Simple I do it this way
So how simple it was to appear
What was said here
My API has as much data as possible
A category among them is a category that is not a category
Filter out those who are not mine
Matches in this category are happening
And that's the category it is
Then what will this
filter method do
First I am equal to
computer
category no
The third one will go there
What category is equal to computer
No
But when it came to Phil T
He was given the category equal
to computer and this object here
He made him come here
Pass Bande did not our this
That's it that's
all My work is done
I'm just going to leave this here
I'm removing this I'm just refreshing it
and I just realized tha
I'll do it friend
I understand what's happening here
I didn't even pass the value
Now I had written Vinod here
You see here that I am Vinod-Vinod-Vinod-Vinod
Look at this
Click is working here
But the Binoth category is there isn't it
Then I have to do this here
my current element to him
This current element will have to pass through
I have passed here now if
I'm leaving look at this and take a second to see it
We will have to refresh the page
Just click
now and if
We couldn't see the data that's okay
That is one thing I would like to mention
Because the data is not arriving here
One thing I would like to tell you is tha
When we are passing the value
I told you in the beginning that the category should pass
But you think that
my category only
Who's data is this data that we have
You like that this data is coming to me
I will come in exchange for value here
My own value was all of it
He was always looking for her
That's not right guys
All it's never even been with us
So that's the problem if the
user clicks on accessories
So here is the value
in the current element we have
Accessories come then those accessories
have gone now my
value will be accessories
This is where we will go
We will get accessories here
This is the dispatch that will
be updated check from the back
I must have already gotten those accessories here
and here when I am in this category
I'm going there so this is the category
Yes here are the accessories-related value
Now on this thumb
All our ads want you to clic
Each one by one
But I'm getting one by one date which is very
Come more often then I will see you
I would like to tell you one thing there is still something in this
Gharbadi is here and this is this at this time
Everything will be okay
This is the same thing that is happening
When I was clicking on any individual one
Then you have to see this
that I saw
Clicking on all data
I am filtering
I want to see everything when clicked on