+ 1

React JS

Hello I am working on a small application to practice, I am currently stuck. I have a counter in a component file which value I want to use in my main file. How can I transfer that information to be accurate and the same one?

6th Jun 2019, 7:00 PM
Isaac
Isaac - avatar
4 ответов
+ 5
Share your code please
7th Jun 2019, 2:14 AM
Calviղ
Calviղ - avatar
+ 5
I created a simple counter component for you. Check it out from https://codesandbox.io/s/simplecountercomp-czltr
7th Jun 2019, 3:10 AM
Calviղ
Calviղ - avatar
+ 1
I just changed some index.tsx to make the component show from App https://codesandbox.io/embed/pokesearch-49sdi
8th Jun 2019, 7:48 AM
Calviղ
Calviղ - avatar
0
Sorry for the late response, https://codesandbox.io/s/pokesearch-kndum I am not sure how to use codeandsanbox, however here is my code. What I want to do is use the counter on my pokemonSearch.tsx file in my app.tsx file so I can do the username and then print the number of pokemons he has found! which in this case is the counter. Thank you!
7th Jun 2019, 8:50 PM
Isaac
Isaac - avatar