To display a kml on a webmap, the KMLLayer component will do it from a url. I don't know if you can do it from a file yet. There was talk about implementing that functionality back 2013.
Esri sample codpen is pretty simple to follow: KML Layer
There are other solutions on here that dissect the xml into features, though not sure if you want to do that.
If this is not what you mean, please add some more details to your question.