How to create MASK with pure JS in React

4

I'm developing an HTML, CSS and jQuery site in React, but I've seen that using jQuery is out of phase in React since it's possible to create some components faster and easier, my question is how to make a jQuery-made mask for Javascript pure, or rather how to do this procedure more effectively in React?

My Mask code is this:

/* Mask Contato */
$(document).ready(function(){
  $('.date').mask('11/11/1111');
  $('.time').mask('00:00:00');
  $('.date_time').mask('00/00/0000 00:00:00');
  $('.cep').mask('00000-000');
  $('.phone').mask('(00) 0 0000-0000');
  $('.phone_with_ddd').mask('(00) 0 0000-0000');
  $('.phone_us').mask('(000) 000-0000');
  $('.mixed').mask('AAA 000-S0S');
  $('.cpf').mask('000.000.000-00', {reverse: true});
  $('.valor').mask('000.000.000.000.000,00', {reverse: true});
});
    
asked by anonymous 18.05.2018 / 15:48

1 answer

2

Take a look at this library: text-mask , with it you can do masking in a variety of ways.     

18.05.2018 / 16:00