JSFiddle - React, Tailwind, and code Playground
HTML
<script src="https://raw.github.com/jwestbrook/simpleprototypemasking/master/automask.js"></script>
<input type="text" class="phoneformat" /><br />
<input type="text" class="phoneformat" /><br />
<input type="text" class="phoneformat" /><br />
JavaScript
$$(".phoneformat").invoke("mask","###-###-####");