React Reusable Component #2 - Button

Learn how to make reusable components in react.
Reusable Button component which can be used application wide with less code and is tested with all scenarios to maintain UI consistent in whole application with value and prop-types validation.
When designing interfaces, break down the common design elements (buttons, form fields, layout components, etc.) into reusable components with well-defined interfaces. That way, the next time you need to build some UI, you can write much less code. This means faster development time, fewer bugs, and fewer bytes down the wire.
Please Like, Share, Comment and Subscribe for more interesting videos.
Facebook : / codewithghazi
LinkedIn: / ghazi-khan
Source Code: github.com/gkhan205/react-reu...
#codewithghazi #reactjs #reactcomponent

Пікірлер: 24

  • @codewithghazi
    @codewithghazi4 жыл бұрын

    Please comment your thoughts on video to improve quality. All feedbacks and suggestions are welcome. 😊

  • @nazamkalsi968
    @nazamkalsi9687 ай бұрын

    🛐

  • @cherant2884
    @cherant2884 Жыл бұрын

    tq bro very useful .............for creating a button compound

  • @jaikrishna3586
    @jaikrishna35862 жыл бұрын

    thanks bro

  • @ashharmansuri6816
    @ashharmansuri68163 жыл бұрын

    Good job bro ,,, I am looking for more videos

  • @codewithghazi

    @codewithghazi

    3 жыл бұрын

    Thanks and sure

  • @gautamkanzariya8651
    @gautamkanzariya86513 жыл бұрын

    i like your method sir

  • @codewithghazi

    @codewithghazi

    3 жыл бұрын

    Thank you 😊

  • @easyfinanceexplained
    @easyfinanceexplained2 жыл бұрын

    Great efforts bro

  • @codewithghazi

    @codewithghazi

    2 жыл бұрын

    Thank you!

  • @PapoDeGamerBR
    @PapoDeGamerBR3 жыл бұрын

    Hello friend, thx again for another video, i got rid of pretty much all questions that i had, but i have a question: I wanna get 2 input values in one click, and address their value on a API, how could i get the value to do that?

  • @codewithghazi

    @codewithghazi

    3 жыл бұрын

    You can check this github.com/gkhan205/formify-react. I have created an npm library with all these components. I will also come up with a video with all the components combined and fetch data to send to API.

  • @gorettaadams8976
    @gorettaadams89762 жыл бұрын

    Thank you very much for this video. I loved it.The explanation was very clear!! But was there any passing of props here? If yes, how?

  • @codewithghazi

    @codewithghazi

    2 жыл бұрын

    Yes, you could pass any prop to the component. Eg: const Button = ({value, onClick}) => ( onClick(event)}> {value} ); Usage:

  • @singhvimlesh
    @singhvimlesh4 жыл бұрын

    Sir If we want to pass component to the button how will be validate.Because if there is multiple component on page load and we have to submit after all validation on click button.So how will validate due to this logic its not possible.

  • @codewithghazi

    @codewithghazi

    4 жыл бұрын

    Hi Nilesh, I'm coming up with a Combined Form Component which will tackle this issue. For now we can save the validation status returned from component to parent component and then on click we can check all are true then we will go ahead with the click or show message.

  • @singhvimlesh

    @singhvimlesh

    4 жыл бұрын

    @@codewithghazi Sir I am trying to do this but I am geting error .So I found your video but its not like that.I have three component on page load but there is different scenario in every component so we cant pass button in every component.Thats why we have to pass all component to the button component and we have to use redux concept for this.to validate the all component and after that button will be submit.till button will disable.So i am asking.

  • @codewithghazi

    @codewithghazi

    4 жыл бұрын

    @@singhvimlesh but in button component you can't pass form fields it will be a bad practice to do so. What we can do is create a component where you have all the fields and the values related to those fields will be there in that component and all your validations will be handled there and then on submit or onclick you can fire the event which you want. If you want to you can also have a look at my form component which I was talking about github.com/gkhan205/react-reusable-form-component/tree/form/src/library/components/Form and Implementation you can check it here github.com/gkhan205/react-reusable-form-component/tree/form/src/pages. I think this form component will help you. I have created it to handle these kind of scenarios and will soon be releasing video for this. So that everybody can know how it can be built with full explanation.

  • @zahraabr
    @zahraabr3 жыл бұрын

    can you share how to test a button in react js? thank you

  • @codewithghazi

    @codewithghazi

    3 жыл бұрын

    Do you mean UNIT Testing by testing button?

  • @zahraabr

    @zahraabr

    3 жыл бұрын

    @@codewithghazi yess

  • @reinismakulis2109
    @reinismakulis21094 жыл бұрын

    doesn't work

  • @codewithghazi

    @codewithghazi

    4 жыл бұрын

    Could you please elaborate the issue? What didn't worked?

  • @DODO-gl5eg

    @DODO-gl5eg

    3 жыл бұрын

    In the button>>index.js file, wrap the button element with return().