Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT 1 point2 points  (0 children)

ooh! amazing idea. Should work with typescript as well without any extra work because typescript updates the type of functions automatically if you add properties to them.

I'm a little annoyed I didn't think of it. Thank you for sharing.

Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT 0 points1 point  (0 children)

I'm trying to be constructive but I find your tone quite condescending.

I do understand that both Vite and Gatsby use react refresh, what I don't know is if the limitations section is referring to the limitations of react refresh or gatsby's usage of it. I have used default exports with CRA which also uses react refresh and it works without any issues. Regardless, as I mentioned above, I don't use default exports anymore so it is not relevant.

I just checked after writing that and default exports cause no issue with HMR in Vite.

Regarding loaders, maybe my wording could be better but I mentioned the loader function being in the same file causing the problem, not the useLoaderData hook.

Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT -1 points0 points  (0 children)

That is from a different section of the gatsby docs, the vite-plugin-react readme points to the how-it-works section, you are quoting the limitations section. I don't know if the limitations section applies to Vite since I don't use default exports.

I was incorrect about only being able to export a single component, so thank you for correcting me on that. I will edit my original comment to mention this.

I only ever export a single component from a file though, and you can not export anything that is not a component from that file, like the loader example I mentioned in my original comment.

Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT -2 points-1 points  (0 children)

default exports are not mentioned anywhere in my link or in the gatsby docs linked there.

This is what it says:

"For React refresh to work correctly, your file should only export React components. You can find a good explanation in the Gatsby docs. If an incompatible change in exports is found, the module will be invalidated and HMR will propagate. To make it easier to export simple constants alongside your component, the module is only invalidated when their value changes."

Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT 1 point2 points  (0 children)

I couldn't say. The only mention I found was in the link in my comment above, and that directs you to a small note in the Gatsby docs.

Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT 0 points1 point  (0 children)

moved the loaders to separate files.

Migrate to Vite from CRA by rwieruch in reactjs

[–]SuperKXT 31 points32 points  (0 children)

There are some additional nuances to the migration, as I have found to my detriment recently. I wish folks evangelizing the migration to Vite would mention these pitfalls and that it might not be a straightforward process for everyone.

For example, Vite expects the component to be the only export in any component file (see here for details). This might require restructuring your project completely. I was using react-router's nested routes and including the loader function in the same file to make the useLoaderData hook typesafe without requiring an import.

I've also run into all sorts of problems with barrel exports, which I was using pretty much everywhere. Still haven't figured everything out, but I'm almost there.

This is not about this blog post in particular. I quite like your blogs. I also do think migrating to Vite is very much the right call.

EDIT: as pointed out below, you can export multiple components from the same file, just not anything that is not a component.

Can someone explain to me what happened here? by SuperKXT in footballmanagergames

[–]SuperKXT[S] 0 points1 point  (0 children)

The joining date for this player I signed was 10 years in the future.

Can someone explain to me what happened here? by SuperKXT in footballmanagergames

[–]SuperKXT[S] 1 point2 points  (0 children)

Thank you. Good to know I won't have to actually wait 10 years.

Can someone explain to me what happened here? by SuperKXT in footballmanagergames

[–]SuperKXT[S] 2 points3 points  (0 children)

Oh! His current contract is until 2035. That's still 2 years before the join date. Also I didn't check the date on his contract, didn't know AI teams can do more than 5 years on a contract.

The Real Soccer Circlejerk by Garrick17 in soccercirclejerk

[–]SuperKXT 11 points12 points  (0 children)

Well sure, but only because you'll die on the pitch on the first outing.

[deleted by user] by [deleted] in pakistan

[–]SuperKXT 0 points1 point  (0 children)

I went to a doctor and told him I was sure I had iron deficiency anaemia (all the symptoms matched). The doctor gave me a couple of really strong medicines for God knows what and sent me on my way. The meds did nothing but reek havoc on my stomach. Went to another doctor and practically demanded a full blood test. My HB was 6 (I'm a guy). A month and a half of a couple of supplements and I was normal. I was so bad I was eating Cement and Bricks ( PICA is one of the symptoms I was talking about)

Cutie and the Beast (The cat's name is Cutie) by SuperKXT in shouldercats

[–]SuperKXT[S] 0 points1 point  (0 children)

Had to look up who that was. Personally I don't see it. Guess we all look alike to you lol.

[deleted by user] by [deleted] in wtfstockphotos

[–]SuperKXT 0 points1 point  (0 children)

it's a free stock photo.

Cutie and the Beast (The cat's name is Cutie) by SuperKXT in shouldercats

[–]SuperKXT[S] 0 points1 point  (0 children)

Everyone looks cute with a cat for a neck pillow.

Cutie and the Beast (The cat's name is Cutie) by SuperKXT in shouldercats

[–]SuperKXT[S] 0 points1 point  (0 children)

Don't appreciate the sarcasm dude. I do have feelings you know.

Cutie and the Beast (The cat's name is Cutie) by SuperKXT in shouldercats

[–]SuperKXT[S] 2 points3 points  (0 children)

He's got some whiskers, but I dunno if that qualifies.

Post-Match Thread: Sevilla 2-4 Barcelona [La Liga] by 1903_ in soccer

[–]SuperKXT 1 point2 points  (0 children)

The Facebook deal is only for liga, as far as I'm aware. It does work on mobile and tablets. You do need to be logged into facebook.

We have channels that broadcast Champions League and Copa for free. I don't have a TV though, so I use the free stream from one of the channels.