Skip to content

Tag: reactjs

How to hide the offcanvas navbar when selecting the links inside of it using react scroll?

Any idea on how to hide/back to its original state when selecting the links inside offcanvas using react scroll? Below is my code and also here is the sandbox code https://codesandbox.io/. App.js Header.js Content.js Im using the ff: react 17.0.2 react-router-dom 6.2.2 react-scroll 1.8.7 react-bootstrap offcanvas 2.1.2 https://react-bootstrap.github.io/components/offcanvas/ I’m not sure if I missed something like useState/useEffect or an attribute

React Modal returns last value of mapped data

Struggling with this issue with the earlier answers not utilizing map function / functional components. When I click my Card, the modal only shows the data of the last Modal: Answer According to your code, multiple modals will be opened and you will see the last modal. If you have 10 products, then 10 modals will be opened. My suggestion

Sending a profile picture from react frontend to flask-restful backend and storing

I want to store profile pictures on the file system (images/{username}_pfp.{extension} and store its location in the database as a string. My frontend react code is and my flask backend code is I have gotten the bits of code relevant to this from multiple sources (Flask – Get the name of an uploaded file minus the file extension, https://flask.palletsprojects.com/en/2.1.x/patterns/fileuploads/). When

Cannot read properties of undefined (reading ‘slice’)

I can’t figure out the problem with the code as I have even matched it with the source code provided by the git user and it is same, but still showing error So below is the error:- Below is the code for shortenAddress component:- Below is the code of the Welcome component Please,can someone tell the answer to this question

Link Element Not Displaying When Selected And Styled As nth-of-type

https://codesandbox.io/s/damp-worker-k7fj6y?file=/src/App.js Why is the .row:nth-of-type(1) > .content:nth-of-type(4) .content <Link/> not displaying? Is it a bug, am I just missing something? I am not looking for an alternative approach to achieve the same result, I am simply asking why the fourth <Link/> is not displaying so I know what is going wrong. Answer Use the :nth-child psuedoselector since you are mixing

How to check if a twilio token is expired

I have a nextjs project and I need to verify if a twilio token is expired or not. I thought about using the library jwt-decode to decode the token and take the exp attribute from it, then compare it to the actual date. The problem is that the exp date seems to be broken because it is always in 1970.