Class for Switch statements
You have just added an unneeded layer of complexity to the problem.

You can just create the factory as an Object

const factory = {
    select(opts, text) { return (&lt;select options={opts} labelText={text} /&gt;) },
    input(opts, text) { return (&lt;input labelText={text} /&gt;) },
    default() { return new Error("Value Not Found") }
};


Then call the function with

(factory[value] || factory.default)(opts, text);