Do all the things like ++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatarSign Up
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple APILearn More
Search - "react hooks"
Programming is cool because you can build out a super advanced use case of react hooks and also forget how to code radio buttons in the same 5 minutes.
Ok, so I work at this "Great" company. I joined a new team recently with a project that is supposed to be a lot better than many of the other projects we have.
THESE MOTHEERRRRRFUCKERS don't even have hot reload on the app. You have to rebuild the app everytime you make a change. Are you kidding me?! We are using React. One of the basics of React is hot reload. I get into a fucking meeting and one of the devs is like, "I have one important thing to tell you, don't use hooks (a not so new feature in react yet something everyone should use at this point)" and the critical reason we don't use it is because they don't want to confuse the Java devs who are used to their little oop style o_O
Maaaan fuck your developers, it's not my fault you guys can't learn something so simple like functional programming. I haven't even started a sprint yet, I'll burn this app and make you rewrite it all.15
If I see "React is revolutionary" one more time....
If you think React or React Hooks are innovative or are implemented correctly or performantly at all, you're a sheep.7
Buckle up, it's a long one.
Let me tell you why "Tree Shaking" is stupidity incarnate and why Rich Harris needs to stop talking about things he doesn't understand.
For reference, this is a direct response to the 2015 article here: https://medium.com/@Rich_Harris/...
"Tree shaking", as Rich puts it, is NOT dead code removal apparently, but instead only picking the parts that are actually used.
However, Rich has never heard of a C compiler, apparently. In C (or any systems language with basic optimizations), public (visible) members exposed to library consumers must have that code available to them, obviously. However, all of the other cruft that you don't actually use is removed - hence, dead code removal.
How does the compiler do that? Well, it does what Rich calls "tree shaking" by evaluating all of the pieces of code that are used by any codepaths used by any of the exported symbols, not just the "main module" (which doesn't exist in systems libraries).
How do you figure out what can and can't be? You can't! Since there is a runtime-based codepath and decision tree, you run into properties of Turing's halting problem, which cannot be solved completely.
So no, Rich Harris, dead code removal is not "silly". Your entire premise about "live code inclusion" is technical jargon and buzzwordy drivel. Empty words at best.
This sort of shit is annoying and only feeds into this cycle of the web community not being Special enough and having to reinvent every single fucking facet of operating systems in your shitty bloated spyware-like browser and brand it with flashy Matrix-esque imagery and prose.
Fuck all of it.20
React developers, What do you think about the new hooks api?
Will you refactor your codebases to use functional components or just stick with classes (even though the react community is moving towards removing classes completely)?
I think its awesome as it reduces the bundle sizes if you use function components though. I have been working on an awesome project for a while and I'm being tempted to refactor the whole codebase to use functions instead of classes. What do you think?19
I don't know what to do with my life anymore, as a self taught web developer, I started like anybody doing HTML, CSS and js, and then I met PHP and WordPress.
why the fuck PHP is ugly ? and why WordPress is uglier ? I tried to learn how to build a simple plugin in WordPress but the hooks system make me want to kill my self, how the fuck PHP powers 80% of the web ? every time I write PHP I wish I was never born, the problem is that I can't change job because I am old and I live in a fucking country who is technologically primitive, they fucking know only PHP and JAVA, no Node, No Ruby, No Python, only fucking PHP.
I learned React, I learned Node but you know what I did this last year ? I raped a themeforest theme for about dozen plus websites, A SINGLE THEME FOR MORE THAN DOZEN CLIENTS, my boss does not care, only me who is not sleeping at night because a tried to customize a Prestashop theme and it gave me cramps in the stomach, I feel depressed and useless, I want to quite my job but I can't, I have mouths to feed, WHY THE FUCK DID I FELL IN LOVE WITH PROGRAMMING, I was happy fixing computers, what can I do if the only project that I have are WordPress and Prestashop?
how did you do to stay sane when working with wordpress and prestashop ? are you not human ?I can't take it anymore.
I need a new road map, fuck it I will focus only on JS and Node and fuck PHP.10
"No. I use React. You see... with hooks... "
"Well, can you change some of the CSS on my website for me?"
"Is it React?"6
Me: Oh, man, there are hooks for react-redux now? I don’t have to wrap components in a higher order component to get information from the redux store and dispatch actions? Could this solve the problem I’m having with data fetching and consistency in the app I’m working on?!
Spends entire Saturday writing a basic server, connecting to an mLab instance, filling said instance with dummy data, starting a create-react-app, writing a reducer, action creators, components, etc. just to test how useSelector(), useEffect(), and useDispatch() would work in an application that isn’t just a simple counter (why is it that like every example is always the counter example?!). Bonus, react-router now ALSO has hooks, so got to play with useHistory() and useParams()
Conclusion: Maybe. It does appeal to me to not have the cascade of virtual DOM that you always get nesting HOCs, but I’m also wary of appearing too willing to jump on it just because it’s the new thing.
Has anybody else played around with react-redux hooks? Your thoughts?
Also, yes, I know, not every app needs redux. It had it when I was brought on and I don’t really have the ability to change that implementation detail now.3
So, let me preface this by saying I come from a backend (mostly c#) background.
The way React handles objects changing in state is horrendous. And if you decide to try using hooks, God help you.
I honestly don't know if it's Blazor or something else that will kill js, but something absolutely needs to. It is a dumb, terrible language. It has to go.
All that said, of course I'll go back to work on it tomorrow.
Sorry, js/react guys/gals. Just venting. I'm sure once I 'get it', it will make sense.10
Who the fuck thought React would be a great idea. I mean I have been creating app from scratch for almost 3 years now and I was able to learn almost anything that was thrown at me, from PHP, Python, Django, Laravel, Node-Express, custom frameworks and everything in between.
Implementing a duration timer in my bright and shiny exercise application. Testing it and I was sure that one second after 7159 it should print out "02:00:00" (since 7200 seconds is 2 hours).
Didn't understand why it took the timer to show 2 hours after 41 seconds instead of just 1 second..5
Converting one of my older projects to use functional components and hooks instead of class components and prop drilling. It's nice.
Though now I have this useState:
const [ disembodiedHead, setDisembodiedHead ] = React.useState("");
Promise it's not as creepy as it sounds.5
Context: New to typescript. Writing a thing, doing it for work, good opportunity to stretch my dev legs. Using a propriety lib, alternatives not an option.
SOOOO, who the fuck thought THIS was a good idea:
1. Lib has minified react in dev (because closed source) meaning no downstream errors AND the entire premise of the lib is that a widget is a react component, so I'm writing typescript react the entire time without downstream errors
2. SHIT docs. By that, I mean there's an API reference page that's so sparse there's literally a set of CRUCIAL interfaces that only say the word 'Interface' on them. That's it. that's what i get. It's an interface. NO FUCKING SHIT SHERLOCK, what the fuck is it though? What's its purpose? Is it an interface for a dog? A dog that has a 'shit' property? or a cat? or a cat eating dog shit? Nobody fucking knows - the docs sure as fuck don't care.
3. No syntax highlighting - editors, IDEs (i've tried a few) can't even find the lib inside this environment, so Code and everything else thinks I'm importing shit that doesn't even exist - so no error prediction, code completion based on syntax of the library, none of that.
4. There are some EXTREMELY basic samples - these samples exclusively use React classes - no function components, no hooks, nada - just classes and even perfect replicas of the sample code display erratic behavior like errors about missing props, so that's mostly FUCKING USELESS
5. And this... this is where the straw breaks the fucking camel's back... there's no... there's no hot reloading... Do you know what that (in conjunction with the previous 4 fuckups) means?
When I write anything or I fuck up (which of course I'm doing every time I write half a line because how the fuck?) I have to restart the client and server EVERY FUCKING TIME and manually test to see if the error (THAT ONLY GETS REPORTED IN THE LOCAL UI) is gone or different.
Then, once I see the error, it isn't an error: it's the minified React error-decoder link and guess what? It isn't really clickable a link OR copyable, meaning that every FUCKING time I get a new error, I have to MANUALLY TYPE A FUCKING 50 CHAR URL TO FIND OUT A GENERIC REACT ERROR MESSAGE WITHOUT A LINE NUMBER OR ANY FUCKING CONTEXT. I HAVE TO DO THIS CONSTANTLY TO SEE IF ANYTHING I'M DOING EVEN WORKS.
6. There's no github to complain to the maintainers or search for issues because it's NOT FUCKING OPEN SOURCE so there is literally nothing to be fucking done about it.
This is due in a week and a half, found out about it last Friday. How's your day going?
PS: good to be back after a long respite from dev ranting.1
I hate React Hooks. Jesus Christ, what the fuck was wrong with using states and components?? It’s like an entirely new fucking framework in itself.9
React hooks are so good that now I don't want to throw my laptop while developing web apps.
I'm trying to get into react for side projects but my java and backend background in general really make things tough. Let's say I have a few data manipulation functions that I want to extract to a separate service and inject it using react hooks (since that's what everyone is using nowadays apparently). I can see it being much more elegant than props, but all the examples I can find resolve around passing state here and there, not passing actual dependencies like a stateless service. Any ideas how I should solve this?7
Even if he's a younger guy than most other examples, my mention is:
He's the inventor of React, which probably changed the way to write (web-)apps for a lot of people and was based on a prototype written in StandardML.
He's also created ReasonML which is not only in many ways a more fitting language to write React, but also a good systems language (props to OCaml and it's unbreakable type system). Many React concepts/patterns have their origins in functional language concepts, including reducers and hooks.3
React, it's declarative way of doing things, and the functional programming methodology it prefers.
Realized how much I've moved on from for-loops and class/object instance to maps, filters and immutability/observers when I worked on a Laravel project after so long and found myself forced to do things in the, erm, "PHP" way, despite spending my initial year and a half of programming working exclusively in PHP.
Sure, there's Class Components and imperative techniques in React but I had blissfully settled into using the flexible nature of doing things enabled by both native JS and React, with hooks, Lodash/Ramda and (almost fanatically) pure functions2
Say what you will but React JS development is utterly exhausting. Every React project is a totally new stack and there is no consensus in the ecosystem.That is how I feel after having worked on 5 big SPA React JS projects over the course of 5 years.
The structure of these projects was all but similar: most used HOC's, some render props, functions-as-a-child, hooks or rather component lifecycles, some used container-components, some Redux, others sprinkled business logic & state all over, and yet others use a mix of server-side rendering and "hydration"...
I dangerouslySetInnerHTML on LazyExoticComponents, and dared not useEffect on the DO_NOT_TOUCH_OR_YOU_WILL_BE_FIRED root property. Hooks embrace functions, but without sacrificing the practical spirit of React, you see.
I didn't make this up. It's verbatim from the code and the docs.
This is not web development, this is at best a tedious fantasy multiplayer game or at worst, a costly joke.6
Why are hooks so awful?
What justifies having everyone using React relearn how to do things when hooks do not bring any new features to React?
Why does getting setInterval to work with hooks require a ~3000 word blog post by a maintainer which constantly assures you this IS a step forward?
Is scrolling up and down a class component really so hard that this clusterfuck is worth it?
Best experience of 2020: Got my first big boy dev job and working on the side at a start up and being involved with big decisions.
Worst experience of 2020: Having to use React hooks8
context: Python Sanic Backend, Bulma Frontend
*this is a direct repost of my rant on my discord*
UGH WHY IS EVERYTHING TOO COMPLICATED FOR NO FUCKING REASON
I JUST NEED AN INTERACTIVE UI WITHOUT EXPLICITLY DOING IT MYSELF WITH TONS OF BOILERPLATE CODE
React - uses JSX
Angular - uses TypeScript
what's next? some weird fucking thing that's not even necessary for basic needs
And why the fuck does react need node.js or some JSX compiler to make things easier?
None of this makes any fucking sense
I just need regex validation and sometimes, custom validation based on other things
Then when the user changes something a small modal shows up asking to save changes
None of this bullshit
It's deadass simple
I don't need routing
No need for your JSX fuckery
No need for your TypeScript shit
I barely would even fucking use those
Fuck react, Fuck angular
React would've been the perfect thing for this shit
they had to make things 100x worse
because react has event hooks
I can just listen to the changes
then display the modal and get done with it
All other processing is done in the backend
IT'S THAT SIMPLE REACT
Validation is provided by the backend, Just fucking use regex in the frontend and that's it
IT JUST NEEDS TO DO SIMPLE THINGS
IT DOESN'T TAKE ROCKET SCIENCE TO DO MINIMAL WORK10
React Hooks question: those states we create in functional components, are they just for UI purposes or does it have use for overall the app? Please enlighten me!1
Started playing around with react this week. Seams nice and i really love the hooks. But next.js on the other hand seams a lot less developed compared to nuxt.js. For example you cant get just the path or just the query parameters from a url without parsing and splitting the url yourself. Is there any other ssr framework for react i could try (excluding gatsby)?2
How many lines is too long for a react component. Im using es6 class approach still over hooks and would say 250s the sweet spot, 400s the limit.
Once you go over 400 things start getting dicey and should be abstracted.7
What are some great react projects utilizing hooks, functional components and possibly the context API.
Need some great ideas for projects from good sources. Need something where I can really LEARN. I mngood at following along YouTube videos . It gets me going then I get into Auto pilot mode. Where I can foreshadow what's gonna happen next. Please help!
1. Project ideas.
2. Great resources1
Okay so I’ve decided to learn React with TypeScript. I’m a backend dev and doing .net core. I know with React people use JSX. But it looks like typescript is becoming the norm. Also hear redux is outdated and the hot new thing is hooks. Lol. Don’t know man. Is this a good place to start? I’m gonna learn a little but of typescript, the. Jump to React. Not gonna do JSX.1
Why should I use Redux in React aside from its beautiful chrome extension? For job purposes only?
I think RxJs and React context API + hooks can do the same job with less codes.
Also, there are a lot of developers who don't like Redux.
Convince me to use Redux13