3
sjwsjwsjw
67d

i have no idea what im doing

javascript, jsx, typescript, react have some of the ugliest and redundant syntax i have ever seen

what are people's favorite reference material for them

do people recommend the official documentation, was surprised react looked better than expected for its docs

Comments
  • 1
    Learn JS first. It does have some quirky aspects but a lot of them are more like scissors given to a child - not automatically dangerous, but quite likely to end up causing harm. There's also something of an obesssion with inlining as much code as possible, this might be satisfying to write but it's a fucker to read.

    Then, once you're resigned to that mess, tackle React. JSX isn't really that bad, but again, it doesn't always incentivise writing neat code.

    Things like hooks you can treat like a black box, don't worry too much about how they work, they just work.

    Also, realise that data flow is objectively difficult and the reason we have a different fad each month is because nobody has stumbled on *THE* way to do it. Your first few attempts are probably going to get tied in logic knots. Just bin them and start again, you're always learning.

    Can't really point you to a good place to learn but avoid any documentation with words like 'awesome', 'blazing fast' etc. It isn't.
  • 1
    The official doc is deprecated.

    New doc:
    https://beta.reactjs.org/

    Try remix, follow the tutorial and see what react app should look like.

    The worst thing about react codebase is legacy redux syntax with ugly class components. Maybe just skip redux and context API. People write the most ugly shit with those. Use react query instead.

    I am not sure about learning JavaScript first if you already have programming experience. If you just go through JavaScript tutorials, you might pick up a bunch of stuff you should never use, such as parseInt, class, foreach, and this. Don't look into old tutorials

    It's easier to treat react as a language instead of a library
  • 1
    @h3rp1d3v I suggest learning it because there are quirks which won't make sense if you haven't. I can't think of any other languages off the top of my head where you instantiate functions and treat them as objects routinely (especially when there is a class keyword - and this addition is, I agree, nonsense) - a function component and the hook lifecycle only make any sense when this is known. Otherwise I do agree, React is better treated as a language of its own, but I do think I'd have been buggered if I hadn't already been writing JS for years.
  • 1
    @MM83 I really don't think it's necessary to understand prototype chain to learn react. Maybe learn JavaScript as a function programming language first if people haven't learned a functional programming language already?

    I do agree it's very important to understand how fucked up JavaScript and it's runtimes are. I want to die every time I looked at the JAVA(script) codebase at work.
  • 1
    @h3rp1d3v even as a functional language it is a bit of an outlier, mainly because (and React is kind of testament to it) we're always trying to implement other paradigms in it - there is rarely a warning that 'What you are about to read IS fucking mental but it's where we ended up', so I think it's easy to assume a failure to understand something when no, what you're reading is actually pretty crazy.

    Figure it's probably easier to take one lunatic on at a time, that's why I suggested learning (at least a little) JS in isolation. Maybe it's better to just take it all on the chin, I dunno.
  • 1
    Compared to what languages? and if you say Python i'm about to delete this thread
Add Comment