Responsive multi-page site made with React & React Router
Design comparison
Solution retrospective
How could I animate a dynamically displayed (w React) component? I'm displaying the sub-pages based on a state variable (set by the user clicking on the sub-page tab). I would appreciate your review and advice!
Thank you! 🙌
Community feedback
- @PeshwariNaanPosted over 2 years ago
I really like your solution. I just finished this challenge as well and I find yours to be a more elegant solution. You have a unique way of using styled components that I haven't seen before. I usually make my code very modular but it can be a bit exhausting for a project as simple as this. I really like your use of useContext to populate the data which I will definitely apply to my app as my solution is clumsy in that respect. As far as a solution to getting the dynamic animations to work - maybe this could be a solution https://www.framer.com/docs/component/ - it is using something called motion. When you call the data, I would think that the component (<div> or whatever) that contains the data will re-render. You can set the animation on the div and I would think it would trigger the animation with the re-render. I haven't tried it but it might be worth a look. Cheers
Marked as helpful1@JT1974Posted over 2 years ago@PeshwariNaan Hi J.D., and thanks a lot for your review and advice, I'll take a look at Motion components.
0 - @Sandrew94Posted over 2 years ago
About the question, try to use GSAP, it's an amazing animations library. With useRef.current you can animate anything.
For the review, the website looks great. i look a little bit at the code, the only advice i give to you is to divide the styled components and the Components to a separate file. Right now, it looks a little bit confusing.
Anyway good job :)
Marked as helpful1@JT1974Posted over 2 years ago@Sandrew94 Hey Drew, thanks a lot for your review! Yeah, separating the styling is a good idea since it now looks messy... Cheers
1 - @abedfetratPosted over 2 years ago
It looks great! Especially the animations. I love how Commander Douglas on the Crew page shoots upwards 😄 Unfortunately I can't give much of a helpfull feedback as I haven't worked with React yet.
1@JT1974Posted over 2 years ago@abedfetrat No problem Abed, thanks a lot for the review! I tried to make Cmd Douglas fly as Superman 😂
1
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