JSFiddle - React, Tailwind, and code Playground

You don't need to start from scratch..

HTML

<script src="http://igorescobar.github.io/jQuery-Mask-Plugin/js/jquery.mask.min.js"></script>
<input type="text" id="myInput" />
<br>
<input type="text" id="input3" />

JavaScript

$('#myInput').mask('00.000.000,00', {
  reverse: true
});

    $("#input3").mask("S00.000.000,00", {
        translation: {
            'S': {
                pattern: /-/,
                optional: true
            }
        }
    });