For whom and when does it make sense to learn a Framework like React.

I am relatively new to webdev and currently just use Flask for my backend to render my HTML files and then just use scss and Typescript on client side. My question is when does it make sense to start learning React and why would you even need it in the first place except for saving time by having reusable components?
9 Replies
Matvey
Matvey•11mo ago
When you do something more complex than a basic todo app on the frontend it's a lot harder without a UI framework like React, because with frameworks you can easily add a JS variable to a page and have it change the page when the variable is changed, without them, you have to create all the page updating logic, grabbing the elements with getElementById(), setting their innerHtml, and creating the elements from code. With react it's just <p>{variable}</p>. Also with something like Next.js you can write both frontend and backend with TS, and reuse code and types between the two. If you want / need to make something like a chat app where you need to load some new data without refreshing the page on some client interaction, you definitely need a frontend framework
Akshay
Akshay•11mo ago
Flask.? Really 🤣 it's the worst micro framework I have ever saw..
haenchenschaschlik
haenchenschaschlik•11mo ago
I only knew Python when I first started and I liked the its ease of use and unrestrictibility, is it really that awful? Yeah, that is probably the most important reason, just easier and faster that plain JS-Dom manipulation
shineslove
shineslove•11mo ago
I think python and flask are great, after you use it for a while, you may want to look into type hints. And if you just like python as a backend api, I'd suggest fastapi You can set up end points in fastapi / flask and call them in React if you want to see how it feels compared to using templates and jinja in flask
haenchenschaschlik
haenchenschaschlik•11mo ago
Call them in react? Is there a different flow for getting data from backend in react instead of just doing a fetch request in the js?
Matvey
Matvey•11mo ago
No, you can use some libraries to make it easier, but they'll still call fetch under the hood
haenchenschaschlik
haenchenschaschlik•11mo ago
ah, I see
Kyle
Kyle•11mo ago
Realistically, it doesn't matter if you can personally make applications and ship them. If you don't intend to market yourself as a frontend dev, then you likely don't need to spend a ton of time learning frontend technologies. But if you plan to market yourself to frontend/fullstack at all, I would learn React. It's just so widely used in the market. Even just a basic understanding of it would likely go a pretty long way.
haenchenschaschlik
haenchenschaschlik•11mo ago
Being hired is not prime goal, I instead want to build good applications and publish them by mostly myself