Creating react TS frontend for my C# .net backend
I have started to look into my frontend after completing the backbone of the backend. I really dont understand how react apps run. I have background in C so i am used to having a main function that starts everything. With the created react TS environment now i dont understand where i should put things. I have made atomic design (atoms, mollecules etc.), but where does stuff actually get executed.
I have researched alot online the past days an i cannot find anything helpful.
22 Replies
index.html
is what loads the bundle that gets created when a React project gets compiled
Let me tell you ahead of time, though: with anything JS worrying about things like where what gets executed, atomicity, et cetera, is a futile effort
Everything is made so that you write your code, build it with some arcane process that gets reduced to vite build
, and it works
You'd have to inspect the final bundle to figure out how the code is routed
But it sill be minified into gibberish, so it's not much of an option
You just make components and use them, that's the gist of it. The build process handles the restI used the create-react-project thing and not vite
That's not recommended anymore
But the principle is the same
Its such a huge rabbit hole
It is
Javascript is a shitshow and a half
the backend was not a rabbithole compared to this
I don't even try to understand it anymore, I just use it
hahahahhahah
should i start over with vite? or can i just keep going
I have done slim to none coding in frontend
You can keep going, it's not that much of a differece
Vite is simply faster than React, and it's universal
You can use Vite with React, Vue, Svelte, Solid, Qwik, Astro, whatever
One tiny little bit of standardization in the hellhole that is frontend
Faster in what
Unless something that replaces Vite comes out
Faster builds, faster dev thanks to hot module replacement
Easier config
Just better DX in general
but nothing impacting the webpage performace itself
No, not at all
Just for the Developer i guess?
yep
so essentially the App.tsx will be the main thing since <App/> is inside the root.render
Yep
I guess if i want multipage i need to make changes in APP then?
routing?
Bare react isn't really fit for multipage or SSR
It's untimately an SPA framework
How can i make it fit for multipage
You can use it with a metaframework like Next.js, that will give you multipage and SSR support
okok thanks!