In react router 5 I could use a but that has been removed from react router 6. I think it’s been replaced with , but that throws a security error for this usecase… For whatever reason. Answer Redirect is no longer in the react-router version 6. For react-router-dom v6, You can use Navigate instead…
Tag: reactjs
Pass data from grandchild to parent in React
Hello i have an array called info[] in a grandchild component and i want my parent component when a button is clicked to access the array. I also want a sibling component to have access to it. How is this possible .. i am a bit confused. Should I use use-context ? Thank you! Answer If I have understand what
React Native UseEffect API CALLS
How to handle multiple api calls in the same render ? Example : I want to get some info from first API call like this for example : and i want to instantly use it for the next API CALL coming under this call example : Soo the question is how to use information that i get inside first API
How do I render components with different layouts/elements using react-router-dom v6
I am having trouble writing code to render a login page with no navbar and sidebar. I have come across some pages that ask similar questions but none seem to pertain to my current situation. How to hide navbar in login page in react router the example given is great but I believe the way of accomplishing that…
Array of Functional Components doesn’t append props content as expected
I want to add an array of <TokenFeed/> functional components to the <Feeds/> component. The problem is that when I do, the onClick() event that passes some text to my <App/> doesn’t work as expected. The array version of <TokenFeed/> when clicked, will replace my <input/> t…
How to generate a zip file synchronously using JSZip?
I’m working on a React.js application, i have a loop from j=1 to j=2000 and i want to download a zip file when j=1 or j=2000. The problem is that the two zip files downloaded at the same time after the end of the loop. in other words the download of the two zip starts when j = 2000. I
How can I call the function of a parent component inside of a child component?
First off, I’m newer to react so please feel free to critique any sort of architectural problems I have, I feel like there’s a better way to write this but I’ve been struggling for an hour trying to get it to work. Parent Element (TileGrid): Child Element (Tile): So there’s a function …
How to pass a function to a component using arrow function?
FYI: I am using ES6 on ReactJS I have a switcher. I need it to switch to the other side when clicked. If click on the side that is currently active does nothing. Here is my sample code Here is the code inside the CustomSwitcher However I got this error As I understand, when passing a function down to a
How it’s possible to have same variable and function name in JavaScript
We usually use React.memo as follow We have a MyComponent function and a MyComponent variable in the same scope, Why the syntax is correct and we have no runtime error like Uncaught SyntaxError: Identifier ‘MyComponent’ has already been declared? Answer Given a function declaration (you don’…
React is not getting uninstalled in windows
I am not able to uninstall react app in windows 10. I tried everything which is in stackoverflow but it is not getting uninstalled. I am using npm . Even I removed nodejs, still it is not working. I actually need to use latest version so when I installed nodejs and react again it is still picking old version …