Last active
June 6, 2023 20:34
-
-
Save JEbertPrime/29411f9f5d50030ad8134c7c003772fe to your computer and use it in GitHub Desktop.
Random HTML component
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 {tags, voids} from './tags.js' | |
export default function RandomElement (props) { | |
var value = props.value ? props.value : Math.floor(Math.random()*tags.length) | |
var Tag = tags[value] | |
if(voids[Tag]){ | |
return( | |
<Tag/> | |
) | |
} | |
else{ | |
return( | |
<Tag>{props.children}</Tag> | |
) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment