Design comparison
Solution retrospective
Hi, This is Abhishek, while making this project I found the following things difficult. Can you tell me how I can Improve them.
- What is the best way to fetch and use json files?
- How to plan before starting coding?
Community feedback
- @anacarolinabmvPosted about 1 year ago
Hello Abhishek, great job the the project :D Quick design tip: add some padding to both of your containers, the text is way to close to the edges. As the for two question you asked, I can help you with the first one: there are two easy ways in which you can use the json files. The first one is with a simple fetch request:
fetch('data.json') .then((response) => response.json()) .then((data) => console.log(data));
Or if you are familiar with asynchronous JS, you can use async/await to fetch you data.
const getData = async function () { const request = await fetch('data.json'); const data = await request.json(); console.log(data); //Data is available to use as if this was synchronous code };
Hope my comment is of any help. Happy coding ✨
Marked as helpful1
Please log in to post a comment
Log in with GitHubJoin our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord