this post was submitted on 30 Sep 2023
4 points (100.0% liked)
Learn Programming
1638 readers
1 users here now
Posting Etiquette
-
Ask the main part of your question in the title. This should be concise but informative.
-
Provide everything up front. Don't make people fish for more details in the comments. Provide background information and examples.
-
Be present for follow up questions. Don't ask for help and run away. Stick around to answer questions and provide more details.
-
Ask about the problem you're trying to solve. Don't focus too much on debugging your exact solution, as you may be going down the wrong path. Include as much information as you can about what you ultimately are trying to achieve. See more on this here: https://xyproblem.info/
Icon base by Delapouite under CC BY 3.0 with modifications to add a gradient
founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
view the rest of the comments
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.
Thanks! Some quick thoughts.
Recommend staying away from LLMs (Bing, ChatGPT et al.) for now.
Take a look at Sharing data between components from the official React quick start guide.
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 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.
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.
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.
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 http://www.olowe.co/about.html in "Contact"
For sure, I'll send you an email.
edit: sent. Thank you again for the help.