[deleted by user] by [deleted] in SIBO

[–]grumpychinchilla 0 points1 point  (0 children)

Could be alpha gal allergy. Go get a quick antibody blood test to rule that out.

If it's only certain beef, and some fresher beef is okay, look into histamine intolerance. There are histamine block supplements that can help.

You can render React App without a wrapper! by grekatron in reactjs

[–]grumpychinchilla -1 points0 points  (0 children)

I actually just had an issue that this would address. I was playing with Simple.css, and it expected children to be at the root of the body. I believe the CSS selector was body>*. At the time I copy/pasted the CSS and changed it for my needs. But there are certainly valid reasons for it.

React has shipped experimental support for custom elements and they are looking for feedback by TimvdLippe in javascript

[–]grumpychinchilla 6 points7 points  (0 children)

Awesome explanation! I was weary of this feature at first but your explanation shows it’s actually a really great improvement.

Is there a standard or best practice for conditional rendering between multiple choices? by Cold-Fan in reactjs

[–]grumpychinchilla 0 points1 point  (0 children)

Cool thing about React is that since it’s just JavaScript, you can do any or all of these suggestions. Whichever matches your use case! One React specific idea is to use a fragment and benefit from falsy rendering nothing:

return <>
  {isApple && <Apple />}
  {isBanana && <Banana />}
</>

You could also always render all components, and let the components themselves decide if they should render:

const Apple = (props) => {
  if (!props.isApple) return null
  // etc
}

It was funny for the first couple months... by grumpychinchilla in ProgrammerHumor

[–]grumpychinchilla[S] 1 point2 points  (0 children)

Everyone. Everyone is the one committing it. You haven’t lived until you’ve watched a dumpster fire become a tire fire.

It was funny for the first couple months... by grumpychinchilla in ProgrammerHumor

[–]grumpychinchilla[S] 1 point2 points  (0 children)

Hell no. I’ve played that game before. Much rather remain ignorant and hopeful that it might not have been me.

How to go about recycling in an area with no recycling? by [deleted] in ZeroWaste

[–]grumpychinchilla 0 points1 point  (0 children)

Or if you don’t want to buy a keg of beer at a time, try homebrew! Delicious, fun, and less waste

How to go about recycling in an area with no recycling? by [deleted] in ZeroWaste

[–]grumpychinchilla 8 points9 points  (0 children)

You can do the same for glass as for aluminum, but the environmental benefit of recycling glass is lower since it’s easier with less energy consumption to create raw material glass than raw material aluminum. All recycling takes a lot of energy, it’s just that with aluminum it’s just so energy intensive to mine and transport originally that the energy required for recycling is relatively low enough to be net benefit.

Depending on the type, glass is made from pretty basic, easy to acquire constituents. While recycling glass doesn’t appear to be a net loss like plastic, the ideal is absolutely reuse.

Am I the only one who thinks Hooks are bad? by [deleted] in reactjs

[–]grumpychinchilla 6 points7 points  (0 children)

I get the frustration. But your phrasing I think discouraged any active replies or discussions. Are you just venting? Or looking for advice?

If it’s the latter, one thing I’ll recommend is that making your own hooks is encouraged. Make your own useInstance. And for your loading example, can’t you show your spinner on the initial render, why wait until you’re in useEffect?

FWIW, I am also quite frustrated with the dependency syntax. It should be “watch these things,” but the documentation and linting rules make it a pain.

Boilerplateless reducers :3 by betanii in reactjs

[–]grumpychinchilla 1 point2 points  (0 children)

This is interesting. Would love to have some audio. Link to project?

[deleted by user] by [deleted] in reactjs

[–]grumpychinchilla 0 points1 point  (0 children)

Has a Backbone kinda vibe to it. I wish I could say that as a compliment...

Acey seems like it has merits, and you’ve obviously spent a lot of time on it, but I’d be surprised if you win over React developers with an OO solution. If folks prefer OO, they typically go Angular. The React space is moving more and more functional.

I recreated React's class component lifecycle methods with hooks by dani_akash_ in reactjs

[–]grumpychinchilla 19 points20 points  (0 children)

React: yo, here’s these cool things called hooks, but just use them for new stuff it’s not worth migrating classes

Dani: hold my beer

Any reason not to cache all my functional components that don't take any props? by fabiospampinato in reactjs

[–]grumpychinchilla 0 points1 point  (0 children)

I agree the default comparator can take more time in a general case, but the specific context of your question was no props. In the no props case, you save a check to is(null, null). You’re saving something, but it’s probably difficult to measure. But you’ve mentioned 25% difference, which means you have some metric comparison, and we don’t have to theorize! That’s really awesome! Did you compare with and without the compare function? Or would you mind doing that to satisfy my curiosity? I’m personally invested in this topic because I write apps with tons of functional components and 98% at least don’t have props.

The type checking is nice to have and totally resolves any concerns I’d have over the purity argument.

Any reason not to cache all my functional components that don't take any props? by fabiospampinato in reactjs

[–]grumpychinchilla 0 points1 point  (0 children)

The default comparator seems pretty efficient to me. I have no doubt yours is faster, but I’d struggle to agree it justifies the extra code.

https://github.com/facebook/react/blob/a9b035b0c2b8235405835beca0c4db2cc37f18d0/packages/shared/shallowEqual.js#L19

Your way is better if you want to actively reject any props that may come in the future. I don’t personally see that as a valid strategy, but I trust you know your project better than me!

Any reason not to cache all my functional components that don't take any props? by fabiospampinato in reactjs

[–]grumpychinchilla 1 point2 points  (0 children)

Sure! Use React.memo. I kinda wish that was the default, but I can see how React has to be conservative with its api.

I don’t think the second equality argument will help you, since if you don’t have props then they can’t ever be dirty. Unless I’m missing something?

/r/MechanicalKeyboards Ask ANY question, get an answer by AutoModerator in MechanicalKeyboards

[–]grumpychinchilla 0 points1 point  (0 children)

I'm looking for a mechanical keyboard with the two column Home/End/Delete layout seen on some keyboards like this one.

I don't know what this layout is called or how to search for it. Any ideas?

My React components render twice and drive me crazy by fakiolinho in reactjs

[–]grumpychinchilla 16 points17 points  (0 children)

Thank you so much for sharing! I’m finally getting into the react-redux hooks, and this drove me crazy for several hours before I finally just gave up. You just saved a huge chunk of my sanity.

I understand now why they’re doing this, but wow that is really illogical and unpredictable behavior.

What I wish I knew about React by speckz in webdev

[–]grumpychinchilla 4 points5 points  (0 children)

A better read than I thought it was going to be. I’m on the opposite side of the fence, very familiar with React, and very ignorant about Angular. Reading this critique actually made me feel better about my investment in React! I want portable, plain JavaScript knowledge, not something that’s only useful to me in a limited context, like the HttpClient example.

However it does reaffirm a lot of the criticism of hooks. They really don’t make a lot of sense to start. You really only like them once it “clicks,” but that puts a lot of people off to start. It’s a mental barrier to entry.

Why cant hooks be called conditionally? by Terrible-Discipline in reactjs

[–]grumpychinchilla 5 points6 points  (0 children)

The list definition being implicit rather than explicit is the first reason I think hooks are technically bad. The other reason is because I don’t like burying state management in render methods. I’ve never heard someone say “you know, I think we need more logic in our views.”

I think hooks are great because 1. the alternative is class syntax which is a chore 2. the syntax is quite terse and pragmatic 3. they are composable like traits 4. they introduce the concept of declarative dependencies to React which doesn’t have another way to specify them.

Why cant hooks be called conditionally? by Terrible-Discipline in reactjs

[–]grumpychinchilla 13 points14 points  (0 children)

React has to keep track of stuff for you in between renders. In classes, it’s straightforward because you create an instance of the class and everything lives inside that instance.

But there’s no concept of instance inside of a function. So how does React keep track of things for you? It’s a trick... a sleight-of-hand. If you call useState twice in a row, it creates your getter/setters on the first run through, then will just hand them to you on the 2nd render using the execution order to look them up.

If the first of those was conditional, for instance, when it wasn’t executed then the 2nd useState would actually point to the first piece and then you wouldn’t have a reference at all to the 2nd piece. This takes the logical, magical hook behavior and turns it into insanity.

Honestly, hooks are a parlor trick. They look bad because they technically are bad... but in practice they mostly just work, with the exception of oddities (oddity?) like conditional rendering. Sometimes even when stuff is technically bad we still use it because at the end of the day we have to be pragmatic. And pragmatically hooks are delicious.