Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
arekxv10545yIf you are doing the bad redux react way of putting all state in one global place (nobody can convince me that this is not just a different way to use global variables) and not use the type system then yes, Typescript will not help you much.
If you are otherwise willing to invest time in awesome type support and separating concerns and state into different files then Typescript is your savior. -
arekxv10545y@platypus True, but using types just for actions is not really using full potential of Typescript. They should be used everywhere and be thoroughly defined. Payoff from that is that you can have all of the autocompletion you want and exactly know with what types are you dealing with. :)
-
josap2115y@arekxv actually I don't think redux has nothing to do with this subject. I would recommend typescript without any esitation.
Then about redux. I do use redux (even in non react apps) and I configure it so that for each type of action TS knows what type the payload should be. If you use enums and interfaces correctly that's really not so complicated to achieve and is super convenient. To the point that in the switch statement in the reducers, for each case (action.type), TS knows what type is the action.payload. -
arekxv10545y@josap True, redux is something I do not like and it doesn't have much to do with typescript. But I've seen typescript getting used as vanilla JS a lot in redux so it was more of an example for me than anything else.
But in summary, if you are prepared to use the type system and commit to it fully, typescript will help you. Otherwise, stick to standard JS :)
Related Rants
How do you feel about using TypeScript with React? I appreciate the benefits, but, as every snippet of React code everywhere on the web is vanilla JS,I just don't want the cognitive overhead.
Yes, I know TS is JS, but, if I'm not going to use the features, why bother? I'd want to strongly type props, state, etc.
What's the status of TypeScript support in the React ecosystem (eg Router, MUI, etc.)?
I'm kinda hoping Reason will get some traction as the type inference is much better, but, will that happen? Or is that going to fizzle so it's a choice between TS and JS?
Appreciate any thoughts on this---including those from anyone who's in the same boat.
Looking for views on TS in React ecosystem---no need to sell me on TS in general.
question
should i?
typescript
react
where are you reasonml?!