JSFiddle - React, Tailwind, and code Playground

by stanney

JavaScript

function A(){
  console.log('A');
}
function B(){
	console.log('B');
}
 
var statemap = {
	0: {
		1:A,
		5:B
	}
}
 
var oldstate = 0, newstate = 1;
 
if(statemap[oldstate][newstate] !== undefined)
	statemap[oldstate][newstate]();
else
	console.log('no state');