Erik
Erik
TTCTheo's Typesafe Cult
Created by Kenzo on 1/8/2024 in #questions
Rendering a component twice
I haven't dealt with that kind of problem in a while so I really don't know what to say. You will have to ask someone else about that
31 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/8/2024 in #questions
Rendering a component twice
That is correct, we shouldn't bloat users' browsing history. However, I think it is ok to use navigate in this case since "/" is literally the root of the app and it's the first thing you visit, so there is nothing to go back to. One thing to keep in mind is if you have any links that should lead to "home" (eg. click on a logo), don't make it lead to "/" so it's being redirected to "/wiki", but rather make it lead directly to "/wiki".
31 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/8/2024 in #questions
Rendering a component twice
If <Wiki /> is the only component rendered on "/" (so, it's basically a page), I would handle this by adding navigate functionality to "/" which navigates to /wiki. This way anybody who visits "/" will be instantly redirected to "/wiki" and I think this is the right approach because there shouldn't be two different routes giving you exactly the same result. If <Wiki /> is just one of many components rendered on each page, then I think it's not possible to preserve it. Hope this answers your question 🙂
31 replies
TTCTheo's Typesafe Cult
Created by Kenzo on 1/8/2024 in #questions
Rendering a component twice
Can you clarify the question a bit? I am not exactly sure what are you asking.
31 replies
TTCTheo's Typesafe Cult
Created by utdev on 1/7/2024 in #questions
Trigger button click on useEffect
The general tip for situations like this is that if you want to "click" a button with code (in your example that was triggering a click inside of useEffect), just trigger the code that is triggered on that button click instead. So, for example, if your button's "onClick" prop is "someFunction", and you want to "click" that button in useEffect, just call "someFunction" in that useEffect.
4 replies