Hey. I don’t think lemmy.world is federating properly with programming.dev/c/learn_programming. I tried reaching out to you with my programming.dev account. I’ve copied my message below:
What course is it?
I’d be happy to be an accountability buddy. We can use a Web Development focused Matrix Room to regularly check in and discuss what we’re working on.
when I use my data handler function to raise the value to the parent, it doesn’t work.
What doesn’t work? What is happening? Is the function returning some unexpected value? Some exception being thrown? Does some other component get in an unexpected state?
Hopefully we can help out with some more context :)
So, over the past few hours I’ve been trying to talk to bing about this, and get some answers. After a few hours, I finally think the problem is a conflict of state. It seems like the state I’m using in my PhoneInput component interferes with the state of the parent component. This seems to be the case since when I click submit, my dataHandler function doesn’t trigger for the PhoneInput component.
So, I guess now I’m wondering how that works? I’ve heard of raising state to the parent, but passing state down, not as data, but as actual state, sounds difficult and somewhat complex. I’m wondering how to use this technique, the uses, and how I can determine when to use it. Or, better yet, maybe I’m missing something and the answer is right outside my reach.
Please note that this component is 1000% broken. I was in the process of changing it with Bings suggestions, but it’s frustrating getting anything useful out of the thing.
If there’s any links, resources, mental models, or anything that you or anyone else think would be helpful in getting this to work, I’m all ears. Also, since it’s pretty obvious that this is an assignment, my limitation is that I cannot use useEffect, and the PhoneComponent has to use 4 inputs.
I’ve been stuck on this for about a week now, so any help, feedback, insight, or articles I should read would be incredibly appreciated.
Try thinking about what is required without thinking about React. I think we need 4 input elements. The value of those elements needs to be concatenated and displayed to the user. Is that right?
From there, we can work out a way to implement what we need using React. Thinking this way helps us start with an even simpler implementation e.g. using just 1 input element instead of 4.
There’s a few things we don’t need right now: unused props like errorMessage, useRef(), and changing focus.
I’ve heard of raising state to the parent, but passing state down, not as data, but as actual state, sounds difficult and somewhat complex.
I think what you’re talking about are Signals from Preact? This feature isn’t required right now and it introduces complexity; I personally find it hard to juggle extra concepts in my head especially when starting out with some new tooling.
If you’re still interested we could try writing a couple of basic components that get us part of the way there.
I’ll stay away from the LLMs for now – they’re largely unhelpful anyway.
The value of those elements needs to be concatenated and displayed to the user. Is that right?
Right. The other components with a single text box seem to work fine, it’s the multiple boxes in the phone component, and it’s local state, that are confusing me to no end.
I think what you’re talking about are Signals from Preact?
Oh, no, when I was talking to Bing it said that the local state interferes with the parent state, so I instead need to bring the parent state into the child. It sort of makes sense? At least the part that local and parent state can interfere with each other makes sense.
If you’re still interested we could try writing a couple of basic components that get us part of the way there.
Please, I’m all ears. I have a feeling that your approach will help me a lot.
Ok! Just so I’m clear on what we need to do, what do you think the final HTML would look like? Happy to keep comms over Lemmy but email might be easier than fighting with Lemmy’s markdown renderer. My deets are at www.olowe.co/about.html in “Contact”
If it matters, what I eventually want to graduate into doing is fixing bugs on the linux kernel.
The Linux kernel is pretty big. One thing you could try to do is start studying similar but smaller kernels. This can make it a lot easier & quicker to experiment with. Plan 9 and OpenBSD come to mind.
These type annotations can help document and make editors parse your code to make suggestions/auto-complete work better.
The second way to use it is by creating a callable. A callable is an abstract base class that requires you to implement the __call__ method. Your new callable can be called like any function.
Avoid projects that require a lot of memory management to begin with. Usually embedded is a good place to start because of this, while a desktop app is a bad place to start. Learn what c is good at (fast memory effecient stuff) and avoid stuff where c has largely been replaced for good reasons.
One of C’s main painpoints is that development is slow. I work in embedded and there people usually use python or another scripting language along c, to handle tasks where performance and memory footprint os not an issue and you just want to build something, and then save c for when you really need it.
learn_programming
Hot
This magazine is from a federated server and may be incomplete. Browse more on the original instance.