Submitted about 1 year ago
Responsive Multi-Step Form with React.JS and tailwindcss
#react#tailwind-css#vite
@Taikyu
Design comparison
SolutionDesign
Solution retrospective
**Challenges I encountered;
```1.
Updating a boolean state with strictMode enabled: because of strictMode, the state update function renders twice, thereby negating any state update that changes a boolean value based on its current state
in addon.jsx
const updateCheckbox = () => {
setCheck(prevCheckState => return !prevCheckState)
}
``` 2.
Pushing to production with a custom background image in tailwind.config.js: i kept getting a 404 not fount after a GET request was sent to the url provided
tailwind.config.js
extend: {
backgroundImage: {
sideBackground: "url('./src/assets/images/bg-sidebar-desktop.svg')",
mobileBackground: "url('./src/assets/images/bg-sidebar-mobile.svg')",
},
**How I solved them
``` 1. Disabled strictMode while the page with the bolean state is being rendered.
wrote vanilla CSS for the background image and media query too input.css #side-bar { background-position: center; background-repeat: no-repeat; background-size: contain; background-image: url(assets/images/bg-sidebar-desktop.svg); } @media (max-width: 520px) { #side-bar { background-size: cover; background-image: url(assets/images/bg-sidebar-mobile.svg); } }
Community feedback
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