React js | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

React js

Dear collegues, there are cards with information about drinks (name, image). In the console you can see the full information of the card from json file (name, image, preparation). It shows on the console. But I can't fix it to show on the screen, the clicked cocktail should open on the page and show the information from json file.

24th Jun 2020, 6:40 PM
Anara Zhunusova
Anara Zhunusova - avatar
23 Answers
+ 1
Anara Zhunusova Or just list your code of the drink component here, so I can study it.
30th Jun 2020, 10:09 AM
Calviղ
Calviղ - avatar
+ 4
People, I fixed it. Thank you very much for support. All respect to you!
30th Jun 2020, 10:50 PM
Anara Zhunusova
Anara Zhunusova - avatar
+ 4
there is just a button “search”.... I don’t know how to fix it corect way. In the beginning all drinks were not supposed to be shown on the screen.. And that button supposed to submit and show drinks that are searched
1st Jul 2020, 9:07 AM
Anara Zhunusova
Anara Zhunusova - avatar
+ 3
Anara Zhunusova When I click a drink on explore page, it actually redirect to preparation page and show the drink information.
30th Jun 2020, 3:41 PM
Calviղ
Calviղ - avatar
+ 3
god bless you! 🙏
30th Jun 2020, 4:05 PM
Anara Zhunusova
Anara Zhunusova - avatar
+ 3
aaa ok! I’ll check 🤗
1st Jul 2020, 8:58 PM
Anara Zhunusova
Anara Zhunusova - avatar
+ 3
I guess I gotta fix the pagenation buttons to list cocktails
2nd Jul 2020, 10:57 AM
Anara Zhunusova
Anara Zhunusova - avatar
+ 2
Anara Zhunusova Here a quick example of cocktail json data populated to a react component. https://code.sololearn.com/WcAnNwHyXp5q/?ref=app
25th Jun 2020, 9:41 AM
Calviղ
Calviղ - avatar
+ 2
thank you, people! I’ll try to fix it
25th Jun 2020, 10:09 AM
Anara Zhunusova
Anara Zhunusova - avatar
+ 2
Anara Zhunusova Great, I will check it later, once I reached home.
30th Jun 2020, 12:21 PM
Calviղ
Calviղ - avatar
+ 2
Thank you so much! I just need help to fix that part to show the message "the drink is not found / no result" if I don't find it. And to show the clicked drink on the separate page. The Searcher component is doing search + Card component is for showing all drinks, Preparation is for the drink that I click on.
30th Jun 2020, 12:39 PM
Anara Zhunusova
Anara Zhunusova - avatar
+ 2
Hi, Kaitlyn 🖐
17th Aug 2020, 7:17 PM
Anara Zhunusova
Anara Zhunusova - avatar
+ 1
let person=JSON.parse({"name":"something", "age":69}) console.log(person) Basically, JSON.parse() converts any json to Javascript objects. So, that we can use that object letter in code
24th Jun 2020, 11:04 PM
🇮🇳Vivek🇮🇳
🇮🇳Vivek🇮🇳 - avatar
+ 1
Anara Zhunusova Can you show the code on Code Playground or GitHub?
30th Jun 2020, 12:24 AM
Calviղ
Calviղ - avatar
+ 1
Anara Zhunusova I think all drinks ahown from beginning is triggered by The conditional !search, try to remove "|| !serach" from function searchingFor and see. function searchingFor(search) { return function(cocktails) { return cocktails.name.toLowerCase().includes(search.toLowerCase()) || !search; } }
1st Jul 2020, 4:12 PM
Calviղ
Calviղ - avatar
+ 1
I need help in React
10th Mar 2021, 1:08 AM
Siddharth MaLhoTra( InActiVe )
Siddharth MaLhoTra( InActiVe ) - avatar
+ 1
Use ReactJS development in 2021, read here - https://techeest.com/reactjs-development-in-2021/
14th Jun 2021, 12:07 PM
Techeest-Tech Talkies
Techeest-Tech Talkies - avatar
0
Anara Zhunusova Just checked out your code. I think you have managed to get the clicked drink on seperated page with preparation and other information.
30th Jun 2020, 3:20 PM
Calviղ
Calviղ - avatar
0
Anara Zhunusova To show a "not found" message, when there is no other searched drink, you could add an extra component before the list of Card components in Searcher.js With the code { data.cocktails.filter(searchingFor(search)).length===0 && <p>The drink is not found / no result</p> } It should show the message whenever there is no search result. On line 69, https://gist.github.com/cv2k10/d1cf28f049ccc4ec90567b9c39b16266
30th Jun 2020, 3:25 PM
Calviղ
Calviղ - avatar
0
thank you
30th Jun 2020, 4:18 PM
Calviղ
Calviղ - avatar