Make a Modal in React using Hooks (Submit/Close/Click Outside)| Beginner Tutorial

Поделиться
HTML-код
  • Опубликовано: 10 фев 2025
  • In this beginner-friendly tutorial, you'll learn how to create a modal in React with close functionality, submit and cancel buttons, and data passing to the parent component. Modals are commonly used in web applications to display additional content or capture user input, and mastering modal creation is an essential skill for every React developer.
    In this step-by-step guide, we'll cover the entire process of building a modal from scratch, starting with setting up the React environment and creating a new component for the modal. You'll learn how to add close functionality to the modal, allowing users to dismiss it by clicking outside the modal. We'll also implement submit and cancel buttons, along with event handling to capture user input and trigger actions accordingly. We will also learn how to use createPortal.
    One of the key features of this tutorial is the data passing from the modal to the parent component. You'll learn how to pass data back to the parent component from the modal, allowing you to update the parent component's state or trigger other actions based on user input in the modal.
    Discord - / discord
    Subscribe - / @code_complete
    ☕ Donate to support the channel! - www.buymeacoff...
    -- 🌟 Useful Tools and Software 🌟 --
    🌐 10% off domains at Domain.com (use code DOMAIN10) - domain.mno8.ne...
    ☁️ FREE $100 for server hosting on Linode - linode.gvw92c....
    📚 30% off annual Skillshare membership (use code annual30aff) - skillshare.eqc...
    -- 🔗 Links 🔗 --
    💻 Code - github.com/Cod...
    DISCLAIMER: Some of the links in the description are affiliate links. The channel will receive a small commission from any sales from these links, but there is no extra charge to you. Thanks for supporting the channel so I can keep making these free tutorials!

Комментарии • 23

  • @raphaeltavares6121
    @raphaeltavares6121 Год назад

    perfect video! Saved me a lot of time in the creation of my landing page and it covered all use cases I wanted!

  • @wintersoldier5894
    @wintersoldier5894 8 месяцев назад +2

    Thank you. It helps with my project. Recommended

  • @ipreet6850
    @ipreet6850 Год назад

    Yoo! happy to see your new video 👍

  • @sowjanyacm9273
    @sowjanyacm9273 Год назад +2

    This helped me . Thanks a lot

  • @rohitkumar-oh3ku
    @rohitkumar-oh3ku 11 месяцев назад +1

    Perfect..💯

  • @Lavith_kuttu
    @Lavith_kuttu Год назад

    Thanks a lot for explaining about createrefportal

  • @linhhuynh5838
    @linhhuynh5838 9 месяцев назад

    very good bro thank for everything

  • @devidvijay1706
    @devidvijay1706 Год назад

    Good explanation

  • @gagandangwal4920
    @gagandangwal4920 Год назад

    thank you so much

  • @ankit1153
    @ankit1153 Год назад

    Please make a video in css required css knowledge with some small projects really helpful....

  • @mohammadmuzmilkabir3067
    @mohammadmuzmilkabir3067 9 месяцев назад

    Thank you boss

  • @shantanu556
    @shantanu556 Год назад

    thanks vro

  • @praulayar4805
    @praulayar4805 Год назад +2

    How styling applied at 12:22 to open button bcz styling is in Modal.css and open button is in App.jsx ??

    • @Code_Complete
      @Code_Complete  Год назад +2

      In react, styles are scoped globally by default so a style defined in one file will be available in any component. This is why we usually use CSS modules or styled components for bigger projects

    • @praulayar4805
      @praulayar4805 Год назад +1

      @@Code_Complete got it.. plz do make more such beginner level tutorial . Awesome work

  • @juansalinas788
    @juansalinas788 3 месяца назад

    Everyone does this kind of content on manners. It would be more useful if you thought about doing this for a larger project using Context and adaptive modals.

  • @ireoluwaogunyinka9173
    @ireoluwaogunyinka9173 Год назад

    You are such a wonderful teacher and i love how you simply explain your code
    can us please do a video on usestate, useeffect and props please....make it so simple that a 5years old would understand

  • @hemanthsg1546
    @hemanthsg1546 Год назад

    Hi can u explain briefly an unit test case for close button ? For this popup

  • @RavindraSingh-zg9eq
    @RavindraSingh-zg9eq Год назад

    my concern is here that how can u send data while clicking submit/cancel/close to parent component using handleButtonClick without context API?

  • @rajchowhan8132
    @rajchowhan8132 11 месяцев назад

    How to customise react bootstrap Close button( like change color) please reply?

  • @sandwipandutta8168
    @sandwipandutta8168 Год назад

    React Hook "useState" is called in function "index" that is neither a React function component nor a custom React Hook function. React component names must start with an uppercase letter. React Hook names must start with the word "use" react-hooks/rules-of-hooks This error is showing how to solve it

  • @PoonamSTrivedi
    @PoonamSTrivedi 4 месяца назад

    👍