The sublayers property of a MapImageLayer allows you to dynamically set renderers on the fly for layers in a map service. To do so, you must reference the layer ID of the service layer and assign a renderer to the renderer property of the sublayer.
// Create the MapImageLayer and define opacity and renderer for each sublayer. const layer = new MapImageLayer({ url: "https://sampleserver6.arcgisonline.com/arcgis/rest/services/USA/MapServer", sublayers: [ { id: 2, opacity: 0.4, renderer: statesRenderer, }, { id: 1, opacity: 0.8, renderer: highwaysRenderer, }, { id: 0, opacity: 0.6, renderer: citiesRenderer, }, ], });To see the default renderers for layers in the map service, either remove the references to the renderers defined in this sample or view the MapImageLayer - Toggle sublayer visibility sample.