gray0531
gray0531
TTCTheo's Typesafe Cult
Created by gray0531 on 1/30/2023 in #questions
When will the react Component remount?
poohhehpoohheh Below is not for sure. Another situation related is render props, it seems like a line function definition(!! I try this, it will not remount) We do not use it like this : <RenderProps someValue> We use it like this: RendrProps(someValue) In this case, because the RendrProps(someValue) return something , and this something will be put inside createElement. Not the RenderProps it self. so no id related problem no remount.
4 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/30/2023 in #questions
When will the react Component remount?
I think that a hidden , unique id is created and append on the component itself when calling createElement(MyComponent) , it will help the react to identify whether to mount it or just rerender it. If a functional component is defined in another component, {the new id is created because the function is not the same} , so new vDom is created , during reconciliation, an unmount and a mount happen. But, I find no doc to prove it.
4 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
I try to unleashed the power of type. But lack of solid knowledge. Appreciate a lot
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
So much confident right now
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
Sorry, I don't get the point of line deterministic code. Is that means people prefer define two specific type for each of them?
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
Thanks man, so CoolStuff!.goodshit is common usage, right?
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
Addon: the goodXxx or badXxx keys related to the type is more than one in my real case.
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
Also want to ask, if you were me, would you use descriminated union in the case?
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
This is so dope, but I do fetch inside the poohheh
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 1/11/2023 in #questions
Complex object interface
Yap, by using type guard , the object can fit the type. But ,how can I use this skill in react component. Not inside some function. I wish for A variable with correct type, and no need to use guard , every time I use it.
20 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 11/3/2022 in #questions
Not sure about router change?
I also did know the points theo mentioned. In order to double confirm them, I turn into the network tab which is a little bit confused(a xxx.json request sent , I saw two cases, one is responses with poohheh and another one is json)(no idea about that) But I do know the key points overall. For now, I just assumed no matter what the responses are(during the client navigation), they will be transform into page props. 😆
6 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 11/3/2022 in #questions
Not sure about router change?
Thanks man. I reviewed the video. I have more confident in after the page load it is just a spa. And when router changes, we just aks for the page chunk(js) and page props (json) if needed.
6 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 10/18/2022 in #questions
Problems of using middleware
But I do see the advantages of your suggestion.
13 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 10/18/2022 in #questions
Problems of using middleware
Always fetch things that may not be used. I am not sure our devops would like the happy
13 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 10/18/2022 in #questions
Problems of using middleware
Once upon a time, I hate server side blocking too. Util, I realized I have to write many dont fetch now ,dont call the effect now in each page, which is annoying. Are you agree?
13 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 10/18/2022 in #questions
Problems of using middleware
I guess the reason why middleware is designed for backend is the first page load can also be guarded, if it is client side middleware,the ssg Page must be shown then redirect, super super weird.
13 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 10/18/2022 in #questions
Problems of using middleware
Thanks for the reply, your answer is like the example the author mentioned right? https://github.com/vercel/next.js/discussions/11822
13 replies
TTCTheo's Typesafe Cult
Created by gray0531 on 10/18/2022 in #questions
Problems of using middleware
Like middleware in nuxt2😆 (Which i never used)
13 replies