I have added an if-else element to my React Component per the documentation; however, due to the syntactical differences between including a React component with <></> and {} I am unsure of how to further configure the component.
Here is a reduced version of what I have (written in TypeScript):
public render() {
const mediaElement: HTMLMediaElement = this.getMediaElement();
return { mediaElement };
}
Here is getMediaElement() reduced:
private getMediaElement() {
//... video can also be returned
return document.createElement("audio");
//...
}
From here, preferably inline, I would like to be able to add class information, etc., something akin to (as also doable in React):
<li className="media-file-title">
How do I go about accessing properties on the element with the above syntax? Ultimately, I am in need of assigning a ref. Any documentation would be great!
Is it only doable through object properties, i.e.:
mediaElement.src = ""
getMediaElement()method implementation? I don't get ifgetMediaElement()returns a React Class or a plain html element ?