JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://code.jquery.com/jquery-2.2.3.min.js"></script>
<p>
Click one square to start then another to draw path.
</p>
<p>
<span>Output:</span><span class="output"></span>
</p>
<div class="matrix">

</div>

CSS

.square {
  width:30px;
  height:30px;
  display:inline-block;
  cursor:pointer;
}
.square.blocker {
  background:#888;
  cursor:default;
}
.square.start {
  background:#0c0!important;
}
.square.path {
  background:#6b6;
}
.square.blocker.path {
  background:#c66!important;
}

JavaScript

/**
 *    ____       _   _     _____ _           _ _                _         
 *   |  _ \ __ _| |_| |__ |  ___(_)_ __   __| (_)_ __   __ _   (_)___     
 *   | |_) / _` | __| '_ \| |_  | | '_ \ / _` | | '_ \ / _` |  | / __|    
 *   |  __/ (_| | |_| | | |  _| | | | | | (_| | | | | | (_| |_ | \__ \    
 *   |_|   \__,_|\__|_| |_|_|   |_|_| |_|\__,_|_|_| |_|\__, (_)/ |___/    
 *                                                     |___/ |__/         
 *   https://github.com/qiao/PathFinding.js
 */
!function(t){if("object"==typeof exports)module.exports=t();else if("function"==typeof define&&define.amd)define(t);else{var e;"undefined"!=typeof window?e=window:"undefined"!=typeof global?e=global:"undefined"!=typeof self&&(e=self),e.PF=t()}}(function(){return function t(e,i,n){function o(a,s){if(!i[a]){if(!e[a]){var l="function"==typeof require&&require;if(!s&&l)return l(a,!0);if(r)return r(a,!0);throw new Error("Cannot find module '"+a+"'")}var h=i[a]={exports:{}};e[a][0].call(h.exports,function(t){var i=e[a][1][t];return o(i?i:t)},h,h.exports,t,e,i,n)}return i[a].exports}for(var r="function"==typeof require&&require,a=0;a<n.length;a++)o(n[a]);return o}({1:[function(t,e,i){e.exports=t("./lib/heap")},{"./lib/heap":2}],2:[function(t,e,i){(function(){var t,i,n,o,r,a,s,l,h,u,p,c,f,d,g;n=Math.floor,u=Math.min,i=function(t,e){return e>t?-1:t>e?1:0},h=function(t,e,o,r,a){var s;if(null==o&&(o=0),null==a&&(a=i),0>o)throw new Error("lo must be non-negative");for(null==r&&(r=t.length);r>o;)s=n((o+r)/2),a(e,t[s])<0?r=s:o=s+1;return[].splice.apply(t,[o,o-o].concat(e)),e},a=function(t,e,n){return null==n&&(n=i),t.push(e),d(t,0,t.length-1,n)},r=function(t,e){var n,o;return null==e&&(e=i),n=t.pop(),t.length?(o=t[0],t[0]=n,g(t,0,e)):o=n,o},l=function(t,e,n){var o;return null==n&&(n=i),o=t[0],t[0]=e,g(t,0,n),o},s=function(t,e,n){var o;return null==n&&(n=i),t.length&&n(t[0],e)<0&&(o=[t[0],e],e=o[0],t[0]=o[1],g(t,0,n)),e},o=function(t,e){var...