Hello, I have a question about reaction js.

Asked 2 years ago, Updated 2 years ago, 69 views

Hello, I am an office worker who is studying React Js. I'm just making a memo web application using React, but I'm asking you because I don't know anything.

Press the Add button currently located in the upper left corner to create an array in the item division with hello written on it. The array has an empty input and a unique id by default.

I want to write input in the division with the title written on it.

For example, I want to write the input contents of item1 on the right side. If you click Item2, you want to see the created input on the right.

I googled, but I don't know how to do it, so I have a question ㅠ<

The amount of the project code is too large to attach to the post, so I upload it to the Githeub address.

https://github.com/Jogeonsang/marcus-app

-----------------------------------------ㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡㅡ

I'd really appreciate your help!

react

2022-09-22 18:34

2 Answers

I received the repo you posted and turned it around, and it's so different from the screenshot that I can't give you a proper answer. Anyway, to make a point... status (state) must be managed.

"Left" and "Right" seem separate, but they use a common props (data), so the parent object must manage the data state as state. That's how you react to that change in state whether it's left or right.

So roughly speaking:


2022-09-22 18:34

First of all, thank you so much for your answer! I posted the wrong address crying I'm sorry. I've changed the address of Githeub, so please refer to it if you could refer to it! Thank you again for your answer!!


2022-09-22 18:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.