vic
KPCKevin Powell - Community
•Created by vic on 11/15/2024 in #front-end
how to calculate border values based on height and width in css for loaders
https://codepen.io/Vicky-clowdy/pen/GRVeYqy
In this code i set 50px for height and width and set 8px for border
So currently I create basic loaders for my project in react as re usable so I can reuse
Currently I use this formula like
const loader size = size * 0.16
Here size will be same for both height and width , For eg if I set size as 50 , width will 50px and height will be 50px
So what I need is , is there any better formula ?
4 replies
KPCKevin Powell - Community
•Created by vic on 11/13/2024 in #front-end
how to make this column as straight in flex
So I want all the contents in same direction
https://codepen.io/Vicky-clowdy/pen/YzmBLgQ
30 replies
KPCKevin Powell - Community
•Created by vic on 11/13/2024 in #front-end
how to re render react re usabelcomponent
So I have an resusable component for Toaster notification with message , color property for now I only make with message
So In that Toaster , it contains message and close icon button so whenever I click the toaster would go off (false) but whenever I get message propes I set useEffect with setShow true
So the problem is if I get same message again
It doesn't show the toaster
Toaster.jsx
Home.jsx
2 replies
KPCKevin Powell - Community
•Created by vic on 11/5/2024 in #front-end
is reusable good for 200lines of code in reactjs
So I m going to have 3 different component with different Imgs for each component and texts too like ( different for each titles or names)
So I was wondering i can do like
Fetch from Mongodb and use useNavigate to pass with state value like this
Here val is the data fetch from backend , so I'm using val.name as routes so it will be different routes
For ex , if I click two it will navigate to /two and if I click one , it will nav to /one and pass different values for different routes
And I use useLocation to get the values from that
So my Question is
All the components have same design but different Imgs and texts
Would u guys think having 200+ lines of code as reusable component
Or should I try useContext or should I go with useNavigate and useLocation ??
1 replies
KPCKevin Powell - Community
•Created by vic on 11/4/2024 in #front-end
how to make a text p tag fills it from parent container
Code link : https://codepen.io/Vicky-clowdy/pen/OJKwzye
So I want that p tag text to completely takes width and fills it
14 replies
KPCKevin Powell - Community
•Created by vic on 11/2/2024 in #front-end
how to make border bottom color transition
https://codepen.io/Vicky-clowdy/pen/MWNXmRN
I want that border bottom transition coming from center and to fill rest of border
8 replies
KPCKevin Powell - Community
•Created by vic on 10/3/2024 in #front-end
how to performance of react
So I made an mern website and use page insights to check the analysis so it shows 55% performance on mobile and 73 on desktop
So I reduced the quality compression of images and add lazy components with lazy componentimg using LazyComponentmg Library and Removed that unused dependcies , can anyone give me suggestions how can I improve it , I can send that website link , i was thinking about input fields onChange event to use useRef hook ?
https://food-order-c58e.onrender.com/delivery
28 replies
KPCKevin Powell - Community
•Created by vic on 9/28/2024 in #front-end
how to make like this "..." when a text goes out of parents width
codepen link :
https://codepen.io/Vicky-clowdy/pen/rNXVgyP
it output as test test test
but i want like
test test test...
that dots
3 replies
KPCKevin Powell - Community
•Created by vic on 9/26/2024 in #back-end
how to prevent logging out user from refreshing the page in express js
so i use express sessions and reactjs for frontend . when i log in the session is set username correctly and can access on other routes as well but once i hit refresh the user log outs , how to prevent this ?
LoginController.js
OrderPage.js
1 replies
KPCKevin Powell - Community
•Created by vic on 9/17/2024 in #back-end
need help with error handling in async functions in js
So i fetch some details from backend and get in frontend..so if i turn off my internet it shows error as "cannot read properties undefined" , so i add as if(!res) throw error and provide catch block in frontend but it shows error instead it catch and store on error variable
heres the code:
react code
express.js
1 replies
KPCKevin Powell - Community
•Created by vic on 9/16/2024 in #front-end
need help with grid in responsive
12 replies
KPCKevin Powell - Community
•Created by vic on 9/14/2024 in #front-end
need help in grid and flex css in responsive
Codepen :
https://codepen.io/Vicky-clowdy/pen/Bagejre
So it wil be like :
Tomato input box button1 button2
But now in resposnive i want it to like this :
Tomato button1 button2
input box
the buttons goes beyond that 100% width
6 replies
KPCKevin Powell - Community
•Created by vic on 9/13/2024 in #front-end
how to wrap these in elements within 50px of height in css
so i want that icon and two p tags text inside 50px of height . in that icon place there will be a mui icons , icon fits perfect but the text going outside , i tried justify-content:unset;
3 replies
KPCKevin Powell - Community
•Created by vic on 9/11/2024 in #back-end
img not displaying from Mongodb img address
So my Mongodb has values as
name : "item1" ,
img : 'Assests/Icons/iconName'
And In react folder , inside public folder
public ->
---Assests/Icons/ "all icon images"
But I gave the icon name in db values .
For example
For burger icon I gave
img : 'Assests/Icons/burger' in db
And I have burger.png have in public folder
38 replies
KPCKevin Powell - Community
•Created by vic on 9/10/2024 in #back-end
how to send post from data from react and capture the data in express
react code
express codE:
6 replies
KPCKevin Powell - Community
•Created by vic on 9/8/2024 in #front-end
Rendering components in reactjs
I have 4 component in app.jsx
<Component 1 />
<Component 2 />
<Component 3/>
<Component 4/>
So I want to render component 1 all the time that is for ( component 2,3)
So when I'm in component 4 , i don't want to render component 1
4 replies
KPCKevin Powell - Community
•Created by vic on 9/7/2024 in #back-end
need help with mongodb
My collection document look like this
Express code :
I use regEx to remove white spaces on hotelName variable and make it as lower case too before using on $regex query
So the problem is if I search Misu it works but it won't work when Burger King because it has space between the words !
Is there any solution or should I change the values in document
1 replies
KPCKevin Powell - Community
•Created by vic on 9/6/2024 in #front-end
increment, decrement multiple elements of an elements in reactjs
So I have 10 divs rendered through map function but I want to increment/decrement the respective element value and display on a element
Code :
4 replies
KPCKevin Powell - Community
•Created by vic on 9/6/2024 in #back-end
how to add params in useEffect axios get request
Backend code :
In reactjs , i don't know how to make that url cuz the hotelname could be different
I tried like this
So idk how to set params in react axios
```
56 replies
KPCKevin Powell - Community
•Created by vic on 9/5/2024 in #front-end
need help with framer motion on reactjs
Code :
So the error is "failed to execute 'animate' on 'element' duration must be non-negative or auto" Typeerror
I don't even include Duration but the error is keep showing whenever I hover that img
1 replies