Created
December 1, 2020 09:59
-
-
Save ilyalesik/0a58de6a6ad4d2c9a7910ab4ccbf9a7e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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