ReactJS. How to compare two fields with react-jsonschema-form such as password / re-enter password fields

Solution for ReactJS. How to compare two fields with react-jsonschema-form such as password / re-enter password fields
is Given Below:

Hi I’m struggling with react and form validation. I am using this plugin: react-jsonschema-form and I can get it working for various fields but I cannot work out how to compare two password fields to make sure that what the user has entered match each other. I can find a few examples but they do not show the whole working component, only snippets and when I try to apply them they do not work. I need to see a fully working self contained component for me to work out how to apply it in my work.

There is a working example here: https://rjsf-team.github.io/react-jsonschema-form/ and click on the validation button.

Can anyone point me in the right direction please?

Thanks.