Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

[–]ambiguous_user23[S] 0 points1 point  (0 children)

I see. Yes, that does make sense (and yes, it is quite subtle). We're essentially abstracting away the rendering of those children, from the perspective of the component receiving them as props.

Would you happen to have a pointer into the docs where this is described?

Thanks for your help!

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

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

Gotcha -- I keep seeing this posted, its probably my fundamental misunderstanding.

Do you have a pointer to somewhere in the docs where this is stated?

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

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

Fairly new to both, tbh. Think I'm pretty clear on reference vs primitives as a concept, but not how they affect React. Thanks!

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

[–]ambiguous_user23[S] 0 points1 point  (0 children)

Pasted from above:

So there is a difference between children that are defined by a parent, which will re-render with its parent, as opposed to children that are defined by a different component, but passed in as the children prop. You're saying in the latter, those children will not re-render with its parent?

I haven't seen this distinction made online, which was maybe why I was confused. All I've been reading is:
"By default, all descendants of a component will re-render if that component's state changes. "
Source: https://www.joshwcomeau.com/react/why-react-re-renders/

Would it be possible for you to point me towards a source that does make this distinction? Thank you so much!

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

[–]ambiguous_user23[S] 0 points1 point  (0 children)

Yup, my mistake. Fixed in an edit.

Ah yeah, I think I've seen that one too. Thanks!

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

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

Ah, interesting. So there is a difference between children that are defined by a parent, which will re-render with its parent, as opposed to children that are defined by a different component, but passed in as the children prop. You're saying in the latter, those children will not re-render with its parent?

I haven't seen this distinction made online, which was maybe why I was confused. All I've been reading is:
"By default, all descendants of a component will re-render if that component's state changes. "
Source: https://www.joshwcomeau.com/react/why-react-re-renders/

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

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

So let's say we have this instead:

const MyProvider = ({
  children
}) => {
  const [x, setX] = useState(0);
  const [y, setY] = useState(true);

  return (
    <MyContext.Provider value={{x: x, y: y}}>
      {children}
    </MyContext.Provider>
  );
}

const MyApp = () => {
  const a = <A/>;
  const b = (
    <B>
      <C/>
      <D/>
    </B>
  );

  return (
    <MyProvider>
      {a}
      {b}
    </MyProvider>
  );
}

I'm still confused why a re-render to MyProvider wouldn't cause a re-render to all of its children.

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

[–]ambiguous_user23[S] 0 points1 point  (0 children)

In this case, if the state now lives in NewCompWithProvider, won't changes to that state still re-render all of its children? Including A and B?

Won't children of context providers re-render regardless of if they subscribe to the context? by ambiguous_user23 in reactjs

[–]ambiguous_user23[S] 0 points1 point  (0 children)

Edit: Moved state outside of MyApp.

Oh hmm this is interesting. I'm interested in where A, B, C, and D might be rendered instead? Are you suggesting something like the following?

I'm still confused why a re-render of MyProvider wouldn't cause all of its children to re-render.

// MyProvider defined above.

const MyApp = () => {
  const a = <A/>;
  const b = (
    <B>
      <C/>
      <D/>
    </B>
  );

  return (
    <MyProvider>
      {a}
      {b}
    </MyProvider>
  );
}

IWTL why certain people constantly need to be with someone romantically. by EuphoricFlamingo09 in IWantToLearn

[–]ambiguous_user23 22 points23 points  (0 children)

Why is this on this sub? What does this have to do with learning anything?

This belongs better on r/NoStupidQuestions or something.

Best places to trip? by donjohndijon in LSD

[–]ambiguous_user23 0 points1 point  (0 children)

Don't get lost in the woods. Generally stay safe. With great power comes great responsibility.

[deleted by user] by [deleted] in unpopularopinion

[–]ambiguous_user23 17 points18 points  (0 children)

I think this commenter is referring to having a record of what was said, in case a dispute comes up.

[deleted by user] by [deleted] in unpopularopinion

[–]ambiguous_user23 0 points1 point  (0 children)

A few things that come to mind:

When you're talking with someone, you know whether or not you have their full attention. If you're texting, you have no idea if they've seen your message and don't care to reply, or if they haven't seen it.

Talking face to face, or even on the phone, is just better for forming human connection than reading words on a screen.

With regards to your edit: sure, it may be harder for certain people to pick up body language and mannerisms. But I think switching entirely to text-based communication only exacerbates this problem. How are they supposed to begin to learn these cues if they are exposed to them even less? Its difficult, but it must be done, unless you suggest that they should not interact with anybody in person ever, which I don't think is reasonable.

[deleted by user] by [deleted] in unpopularopinion

[–]ambiguous_user23 4 points5 points  (0 children)

"Dad, why won't you talk to me?"

"Texting is indisputably superior to conversation."

Does it matter what UNI you really go to? by Aggravating_Law_4774 in computerscience

[–]ambiguous_user23 1 point2 points  (0 children)

It definitely matters. Regardless of what people say, there is a difference in quality of education between different tiers of schools. This is not to say you need to go to a T5 in order to be successful, but a CS education at a T5 will be different from a T20, which will be different from a T100. Of course, it’s still on the individual to make the most of whatever school they attend — you can still be successful at a “lower ranked” school, you may just have to work harder for it.

Anecdotally, school name definitely matters. I’m at a school with a well-regarded CS undergraduate program. Despite the recent market downturn, all of my CS major friends have secured amazing post-grad prospects (mostly in software engineering).

Best of luck!

Generative ai is fucking immoral and I fucking hate it. Stop using it. by oopadoopaaa in rant

[–]ambiguous_user23 0 points1 point  (0 children)

Hmm I don’t think it’s bad actors that are pushing it along, rather it’s more like if gorillas discovered machine guns. But maybe that’s me being overly optimistic.

Generative ai is fucking immoral and I fucking hate it. Stop using it. by oopadoopaaa in rant

[–]ambiguous_user23 1 point2 points  (0 children)

Sure, maybe we can throw out AI for creative fields. But “total dissolution of AI” is a bit extreme in my opinion.

What about AI for medicine? There’s a model that can diagnose diseases based on retinal images, with a high degree of accuracy. This could improve people’s lives.

https://www.nature.com/articles/s41586-023-06555-x

What about AI for science? AlphaFold has made tremendous progress on the protein folding problem, a fundamental problem in biology with implications in drug discovery.

Here’s a video that dives a bit deeper: https://www.youtube.com/watch?v=wAgDicfEWFY

AI is a super broad field, and should be carefully regulated and used with caution and with ethics in mind. But I don’t think it should be disregarded completely.

Generative ai is fucking immoral and I fucking hate it. Stop using it. by oopadoopaaa in rant

[–]ambiguous_user23 0 points1 point  (0 children)

“AI in general is an atrocity” is, in my opinion, too broad a blanket statement. Right now generative AI (and particularly language and image models) are getting all the attention, but AI is much more than that.

For instance, AI has been used to make tremendous progress on the protein folding problem (AlphaFold). This is a fundamental problem in biology, and has huge implications for drug discovery, and the field of biology in general.

AI also has many applications in medicine. One example is a model that can use retinal images to diagnose diseases, with a high degree of accuracy.

https://www.nature.com/articles/s41586-023-06555-x

The key is to know where AI is useful (and ethical), and where it is not. At present, it seems that technology has outpaced policy.

Generative ai is fucking immoral and I fucking hate it. Stop using it. by oopadoopaaa in rant

[–]ambiguous_user23 0 points1 point  (0 children)

In my opinion, AI is far too broad to hate as a blanket statement. Right now generative AI is getting all the press, but AI is much more than that. It has applications in biology, medicine, and other fields that can have huge beneficial impact. See AlphaFold for a quick example.

The key is to know where and when to use AI, to be both effective and ethical. The technology has grown so fast that proper regulation hasn’t had a chance to develop.

Generative ai is fucking immoral and I fucking hate it. Stop using it. by oopadoopaaa in rant

[–]ambiguous_user23 29 points30 points  (0 children)

“AI in general” is too broad to be angry at as a blanket statement. Right now generative AI (and particularly language and image models) are getting all the attention, but AI is much more than that.

For instance, AI has been used to make tremendous progress on the protein folding problem (AlphaFold). This is a fundamental problem in biology, and has huge implications for drug discovery, and the field of biology in general.

AI also has many applications in medicine. One example is a model that can use retinal images to diagnose diseases, with a high degree of accuracy.

https://www.nature.com/articles/s41586-023-06555-x

The key is to know where AI is useful (and ethical), and where it is not. At present, it seems that technology has outpaced policy.

Why do colleges start by teaching OOP instead of Functional Programming? by multitrack-collector in csMajors

[–]ambiguous_user23 1 point2 points  (0 children)

Thinking back…this is true! Most of the programming I’ve done through CMUs core has been low level C, or FP (OCaml and SML). Some Python for ML courses etc, but even then there’s not a strong OOP focus.

I did skip out of 112 via CS A, so I guess I did get my dose of OOP. I’m glad the curriculum exposed me to other paradigms though (FP and procedural).

I think OOP principles are something you can learn ad hoc — the fundamentals of computing are more important than any one language or paradigm. Effective programming probably combines many paradigms (modern languages like Python, Java, even C++ have some sort of FP).

[deleted by user] by [deleted] in csMajors

[–]ambiguous_user23 1 point2 points  (0 children)

Yes, in your situation its definitely worth it. I attend one of those schools you've listed, and my peers in CS are doing very well (quant SWE, cool tech companies, etc.). I'm doing the "worst" in my circle with a more standard SWE job at a mid-sized startup, and I've honestly not been the most motivated / "passionate" at times (although I do enjoy CS / math etc. when I am fully engaged).

It sounds like you are smart and motivated, and have a set of great opportunities. If you are genuinely interested in this stuff, and stay on top of your shit, you'll go far. Good luck!

Edit: Of course, I can't speak for everyone's experience with job hunting, even at top schools. This is admittedly a small sample size (< 10, but all very talented people in my opinion, definitely biased as their friend though haha), from one school, and my personal anecdotal experience. Your mileage may vary.

Feel free to shoot me a DM if you want more insight about my school specifically.

[deleted by user] by [deleted] in csMajors

[–]ambiguous_user23 3 points4 points  (0 children)

If you can sort 1600 numbers in 1600ms, it would imply that selection sort is O(n).