Skip to content
  • Unlock Pro
  • Log in with GitHub
Solution
Submitted 10 months ago

Multi-step-form using reactjs and tailwind

react, tailwind-css, vite
Azimapata•90
@Azimapata
A solution to the Multi-step form challenge
View live sitePreview (opens in new tab)View codeCode (opens in new tab)

Solution retrospective


What are you most proud of, and what would you do differently next time?

I’m most proud of the successful implementation of the multi-step form with dynamic state management, particularly the way each form step is handled by separate components. This modular approach has allowed for better organization and readability of the code. Additionally, the ability to manage the selected add-ons in the parent component and pass them down to the relevant steps has made the form more interactive and user-friendly. The implementation of the sidebar with dynamic styling to reflect the current step is another highlight, as it improves the user experience by providing clear navigation cues. Next time, I would focus on refining the state management approach to make it more efficient, possibly by exploring context or more advanced React patterns to avoid prop drilling. I would also consider enhancing the form validation process to ensure a smoother user experience and fewer errors during form submission. Additionally, I’d spend more time on UI/UX design aspects to ensure that the form not only functions well but is also visually appealing and intuitive for users. Lastly, I would start the project with a more robust testing strategy to catch any issues early in the development process.

What challenges did you encounter, and how did you overcome them?

State Management Across Multiple Steps: One of the biggest challenges was managing state across the different form steps, particularly ensuring that the data selected in one step was correctly passed and displayed in subsequent steps. This was especially tricky with the add-ons, as they needed to be updated dynamically based on user selections.

Sidebar Navigation and Styling: Implementing the dynamic styling in the sidebar to reflect the current form step was also challenging. Ensuring that the correct styles were applied as the user navigated between steps required careful handling of state and conditional rendering.

Component Communication: Another challenge was ensuring smooth communication between the parent component and the child components (i.e., the form steps). Managing the flow of data and ensuring that each step had access to the necessary information without excessive prop drilling was a delicate task.

State Management: To tackle the state management issue, I centralized the state in the parent component, which allowed me to control the flow of data more effectively. I used useState to manage the selected add-ons and passed the necessary data down to each form step via props. This ensured consistency across the steps and made it easier to update the state as the user progressed through the form.

Sidebar Navigation and Styling: For the sidebar, I implemented a switch case approach to manage the styling dynamically. By setting up conditional rendering based on the current step, I was able to ensure that the sidebar accurately reflected the user's progress, with the appropriate styles applied to each step number.

Component Communication: To improve component communication, I refactored the code to minimize prop drilling by passing only the necessary data and functions to each child component. This made the codebase more maintainable and reduced the complexity of data flow between components.

Overall, these challenges pushed me to think critically about state management and component structure, ultimately leading to a more robust and user-friendly form.

What specific areas of your project would you like help with?

State Management Optimization: While I’ve centralized state in the parent component, I’m curious about more efficient ways to manage state across multiple components, especially in larger forms. I’d like guidance on using React Context or other advanced state management techniques to reduce prop drilling and make the codebase more scalable.

Form Validation: I’d like to improve the form validation process to ensure that the user experience is as smooth as possible. Currently, the validation is basic, and I’d appreciate advice on implementing more robust validation, possibly with libraries like Formik or React Hook Form.

Performance Enhancements: As the form becomes more complex, I’m concerned about potential performance issues. I’d like help in identifying and addressing any performance bottlenecks, such as unnecessary re-renders or inefficient state updates.

UI/UX Design Improvements: I’m interested in enhancing the visual design and user experience of the form. Suggestions on better UI/UX practices, particularly for multi-step forms, would be very helpful.

Testing Strategy: I want to ensure that my project is well-tested, but I’m not entirely confident in the testing strategy I’ve used. I’d like guidance on setting up more comprehensive tests, especially for user interactions and state changes in the form.

Responsiveness: I want to ensure that the multistep form is fully responsive across different devices and screen sizes. I’d appreciate advice on best practices for implementing responsiveness, especially for handling complex layouts and ensuring that the form remains user-friendly on mobile devices. Adding responsiveness would greatly enhance the accessibility and usability of the form, making it more effective for a wider range of users.

Code
Select a file

Please log in to post a comment

Log in with GitHub

Community feedback

No feedback yet. Be the first to give feedback on Azimapata's solution.

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
Frontend Mentor logo

Stay up to datewith new challenges, featured solutions, selected articles, and our latest news

Frontend Mentor

  • Unlock Pro
  • Contact us
  • FAQs
  • Become a partner

Explore

  • Learning paths
  • Challenges
  • Solutions
  • Articles

Community

  • Discord
  • Guidelines

For companies

  • Hire developers
  • Train developers
© Frontend Mentor 2019 - 2025
  • Terms
  • Cookie Policy
  • Privacy Policy
  • License

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

Oops! 😬

You need to be logged in before you can do that.

Log in with GitHub

How does the accessibility report work?

When a solution is submitted, we use axe-core to run an automated audit of your code.

This picks out common accessibility issues like not using semantic HTML and not having proper heading hierarchies, among others.

This automated audit is fairly surface level, so we encourage to you review the project and code in more detail with accessibility best practices in mind.

How does the CSS report work?

When a solution is submitted, we use stylelint to run an automated check on the CSS code.

We've added some of our own linting rules based on recommended best practices. These rules are prefixed with frontend-mentor/ which you'll see at the top of each issue in the report.

The report will audit all CSS, SCSS and Less files in your repository.

How does the HTML validation report work?

When a solution is submitted, we use html-validate to run an automated check on the HTML code.

The report picks out common HTML issues such as not using headings within section elements and incorrect nesting of elements, among others.

Note that the report can pick up “invalid” attributes, which some frameworks automatically add to the HTML. These attributes are crucial for how the frameworks function, although they’re technically not valid HTML. As such, some projects can show up with many HTML validation errors, which are benign and are a necessary part of the framework.

How does the JavaScript validation report work?

When a solution is submitted, we use eslint to run an automated check on the JavaScript code.

The report picks out common JavaScript issues such as not using semicolons and using var instead of let or const, among others.

The report will audit all JS and JSX files in your repository. We currently do not support Typescript or other frontend frameworks.