I have a React frontend and class components inside it. Moving to React 18 and Route 6, some important changes arose. One difficult problem is getting route params. They proudly introduced hooks but all the examples I found are with function components and using useParams. Unfortunately, useParams doesn't work with class components. The only solution I found till now is to use same function components just as wrappers around class components but this is cumbersome, especially when Redux and Thunk are involved. For example, it took me a lot of time only to find out that useDispatch has to be cast to ThunkDispatch and I am sure the problems won't stop here. I also wouldn't like to change all my class components to function components. As a matter fact I prefer the former.
alternative to useParams() in class components in React18, Route 6
65 Views Asked by Gigi At
0
There are 0 best solutions below
Related Questions in REACT-ROUTER
- in react-router, it changes url but doesn't navigate?
- how can i change the hash prefix/format of React-router
- React - Authentication process : Cannot dispatch in the middle of a dispatch
- Adding resolver to React-router
- Amazon S3 Redirect Rule - Preserve Query Params
- React-router: how to get previous path using Link
- React Router with RefluxJS - Changing route Programmatically from a Store
- React-router: type.toUpperCase is not a function
- React page layout using react-router
- Create CRUD UI in reactjs with backend api
- Nesting in Default Route
- react router - get current route
- Access component context inside ReactRouter's willTransitionTo and willTransitionFrom
- react-router go back a page how do you configure history?
- react-router link not receiving router in context
Related Questions in REACT-18
- should not useTransition be non-blocking?
- why globalId is incremented by 2 while I click only one time on Create Todo or submit the form. How to solve it
- React SSR giving Element type is invalid error
- Access React component variable from Devtools in production build
- alternative to useParams() in class components in React18, Route 6
- Next.js config is not loading sass files correctly from bootstrap version 5
- @twilio/video-room-monitor with react 18
- UseEffect React 18 - Taking a long time to make api calls
- Why render error in react v18 occures although I do not use legacy code?
- createRoot(...): Target container is not a DOM element in React Test file
- Why does react 18 warn using createRoot inside the container?
- React-18 | You are calling ReactDOMClient.createRoot() on a container that has already been passed to createRoot() before
- create react app react 18 with typescript
- TypeError: Cannot set property 'usingClientEntryPoint' of undefined
- React 18 useId cannot be in key
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?