Skip to content

Instantly share code, notes, and snippets.

@ilyalesik
Created December 1, 2020 09:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ilyalesik/0a58de6a6ad4d2c9a7910ab4ccbf9a7e to your computer and use it in GitHub Desktop.
Save ilyalesik/0a58de6a6ad4d2c9a7910ab4ccbf9a7e to your computer and use it in GitHub Desktop.
import * as React from 'react';
import * as renderers from "./renderers"
export const renderer = async (jsx: React.ReactElement<any>) => {
if (typeof jsx.type === "function") {
const result = jsx.type(jsx.props);
await renderer(result);
} else if (renderers[jsx.type]) {
await renderers[jsx.type](jsx.props);
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment