Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found
Not Found

Submitted

Bookmark - ReactJS, Webpack, Sass, BEM, Mobile first, IO API

P
tedikoโ€ข 6,560

@tediko

Desktop design screenshot for the Bookmark landing page coding challenge

This is a solution for...

  • HTML
  • CSS
  • JS
3intermediate
View challenge

Design comparison


SolutionDesign

Solution retrospective


Hello๐Ÿ‘‹!

This is my 30th solution on Frontend Mentor! ๐Ÿฅณ The project was made using ReactJS which I just started to learn. I've always liked breaking my code into modules or parts so I instantly liked building my app using components that manage their own state. I also enjoyed writing JSX syntax which makes the code very readable and transparent. The fact that rendering logic, functionality is inherently coupled with UI logic is awesome. I look forward to learn more about React because many of its benefits can be seen at first glance. List of things I learned or used creating this project:

  • I used ReactJS library to create an app. React is a declarative, efficient, and flexible JavaScript library for building user interfaces. It lets you compose complex UIs from small and isolated pieces of code called โ€œcomponentsโ€. Read More(1) - Watch tutorial(2).
  • Implemented defer to my script tag. The defer attribute tells the browser not to wait for the script. Instead, the browser will continue to process the HTML, build DOM. The script is fetched asynchronously, and itโ€™s executed only after the HTML parsing is done. Read More
  • Prevented body scrolling on iOS while the mobile menu is open. So far I was using helper class with overflow: hidden on the <body> element to prevent scrolling. But unfortunately, that does not work on iOS. (It does work when nav is on top of the window whole time but it doesn't when we add position: fixed to it when we want our nav to be always on top of our viewport). I use position: fixed on body in combination with storing the scroll position of the user so we can restore the scroll position after the fact. Read More

In this project I also added touch-enabled mobile navigation, accessibility skip to content link, sticky nav menu using Intersection Observer API and others. You can find more about the things I used in the project in the README on github. I just wanted to point out new things here.

I would like to thank @ApplePieGiraffe for giving me great resources about React and also @brasspetals for sending me good article about how to section your HTML. During the course of the project, I noticed how much I could use a code formatter like a prettier. I will definitely start using it in the next project, if you have any tips about it, please. Any good resources about react files architecture? Additional feedback or a criticism will be appreciated! ๐Ÿ˜…

Thanks! ๐Ÿ˜

Community feedback

P
ApplePieGiraffeโ€ข 30,545

@ApplePieGiraffe

Posted

Hello, tediko! ๐Ÿ‘‹

Amazing job on this challenge! ๐Ÿ‘ And kudos for trying out React! ๐ŸŽ‰

Like Anna said, your design comparison is pixel-perfect! And I love the transitions you added to the various interactive elements of the site (especially the "Features" section). ๐Ÿคฉ

Here are a few tiny things I'd like to suggest,

  • I don't think you need to wrap <App /> in <React.Fragment> in index.js because that is just a single component being rendered to the DOM. React.Fragment is often useful when you have to render or return multiple elements and you don't want to wrap them in an unnecessary element such as <div>. Also, if you ever do want to use fragments, you can use the empty tag syntax (like <>) instead of React.Fragment (it's like the same thing but just shorter and nicer to read)โ€”except if you want to pass the key prop to the fragment (in which case you have to use React.Fragment instead).
  • In components like Button.js, you can use the children prop to access whatever is put between the component's opening and closing tags, meaning instead of having a text prop, you can simply include children in the list of props to be destructured and then use {children} instead of {text} in your JSX. This will look nice when you are using Button.js and becomes especially helpful when you want to include components as the children of an element.
  • The information for the extension cards isn't something that you need to keep in state, because nothing about that information actually changes from render to render. You can simply include the data for the extension cards as an array outside the main function in Extensions.js. (The same can be done for the data for the FAQs.)
  • Also, this is just a tip, but if you have a component like ExtensionsCard.js within a folder named Extensions, I like to drop Extensions in the name of the component (and name it something like Card), since it is already categorized by the name of its folder. It helps to keep names of things a little bit shorter and cleaner (but maybe that's just me).
  • You might already know this and just wanted to make the FAQs section with React, but you can use the native HTML <details> and <summary> elements to easily create a fairly accessible accordion without having to use any JS (in fact, that's what we switched to for FAQs on Frontend Mentor). The only downside is that animating the height of the expanded state of the element is a slightly tricky.
  • If you ever use useEffect, remember to include a dependency array to make sure that that hook is only called when necessary (otherwise, it will be called on every render, I think). The useEffect in useFeaturesToggle.js could probably take an empty array as its second argument so that it only adds an event listener once (when the component is mounted). The useEffect in Header.js could maybe have windowWidth in its dependency array so that it re-runs only when that variable changes. (LOL, I used to forget to do this, too.)
  • I think what you have for the file structure of your project is good (especially for the size of this project). If you'd like to read more about how to structure React apps, Matt pointed me to this nice article in his feedback to one of my React solutions.

Wowโ€”I just realized how long this is! These are just of my thoughts, though, and I hope you'll find them helpful. ๐Ÿ™‚

Overall, you've done really well (especially for you first React projectโ€”better than me, haha)! ๐Ÿ˜„

Of course, keep coding (and happy coding, too)! ๐Ÿ˜

Marked as helpful

5

P
ApplePieGiraffeโ€ข 30,545

@ApplePieGiraffe

Posted

Oh, yes, and congratulations on submitting your 30th solution on Frontend Mentor! ๐Ÿ˜†

Also, thanks for the shoutout! ๐Ÿ˜€

1
P
tedikoโ€ข 6,560

@tediko

Posted

@ApplePieGiraffe Hello, APG! Thank you for your comprehesive feedback! I will go over everything and learn a valuable lesson from it.

  1. Indeed, I don't need <React.Fragment> in index.js. I can keep it simple in one line.
  2. Wow, children prop is really more cleaner and also have own adventages that you point. I changed it already!
  3. Right! Regarding this, when I was doing the feature section tabs (I left it for the end), I already made a separate file for the data because I noticed my mistake but it flew out of my head to change rest.
  4. Yeah, you're absolutely right. These names are due to the fact that in the beginning I had no division into folders, just kept everything in the Components folder. When my code grow I realized that I have to separate them and I didn't change names of files. I'll definitely use shorter names in future projects.
  5. It's funny because eight months ago you were first person to advised me to use <details> and <summary> (it was for faq accordion card challenge). I had it in mind and I remembered it but for animation reason I decided to use buttons with aria-controls. Additionally, I wanted to do some logic work in React.
  6. Good catch! I guess my thinking was (wrong ๐Ÿ˜†) that since I'm removing eventListener, I don't need to pass that empty array since it will remove on render anyway - but you've right.

Again, thank you for linking me an article and for valuable time consuming feedback. Have a great day!

1
P
ApplePieGiraffeโ€ข 30,545

@ApplePieGiraffe

Posted

@tediko

Awesome! ๐Ÿ˜€ I'm really glad to hear that it was helpful! ๐Ÿ‘

Have a great day, as well! โ˜€๏ธ

1
Michalโ€ข 665

@mbart13

Posted

Hello Tediko,

For files architecture, I'm using Brad Frost's atomic design in react projects (well, one so far + the big one I'm working on right now) https://atomicdesign.bradfrost.com/chapter-2/

It just fits react in my opinion, but there are many approaches to structuring react project

I'm wondering how do you like functional style of programming in react? You used to do OOP in vanilla js

Marked as helpful

3

Jayโ€ข 695

@Junjiequan

Posted

@mbart13 I tried to learn the so called atomic design pattern.....but the instruction is really confusing to me :/ probably the concept is too advanced for me yet.

0
P
tedikoโ€ข 6,560

@tediko

Posted

@mbart13 Hello, Michal! Thanks for your feedback and for tossing me this link. I'll take a proper look at it.

To be honest I am currently so delighted with React that everything about that looks good for now. I really liked OOP but I noticed adventages of using functional programming like clearer code, pure functions, declarative style. I think I need to dig more deeply into and make few more projects to say something more. Thanks again!

0
Anna Leighโ€ข 5,135

@brasspetals

Posted

Hi, tediko! Congrats on your 30th solution! ๐ŸŽ‰๐Ÿฅณ๐ŸŽ‰

That pixel perfect screenshot! ๐Ÿ™Œ Awesome work! While the entire project is of course, fantastic, I really like all of the transitions/animations/UX of the features tabs. So slick! ๐Ÿ’ฏ Works well on keyboard too. The email error message is also really nicely done, and the responsiveness is top notch. The medium/tablet styles are handled really well, and there's a very nice flow as you move between different widths and layouts.

I don't know React, so can't give any critique there. I really hunted, and can't seem to find anything else either. All I can say, is that you've done an excellent job! ๐Ÿ˜„

Marked as helpful

1

P
tedikoโ€ข 6,560

@tediko

Posted

@brasspetals Thank you for your feedback yet again! This means a lot to me. :)

0

Account Deleted

Hello tediko,๐Ÿ‘‹

Congratulations on completing your 30th solution๐ŸŽ‰๐Ÿ‘

Nothing to suggest here because I don't know how to use (react library), but your solution looks good and responsive also.

Great work here ๐Ÿ‘

1

P
tedikoโ€ข 6,560

@tediko

Posted

@Nik-web12 Hello, Nikhil! Thank you very much for kind words!

0

Please log in to post a comment

Log in with GitHub
Discord logo

Join 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