How to feature highlight in selected layer with Dynamic layers with react js

here is try out but not working , here is feature return undefined

  map.on('singleclick', function (evt) {
        // alert('title')
        var point = map.getCoordinateFromPixel(evt.pixel)
        // console.log(point)
        const hdms = toStringHDMS(point)
        // console.log(hdms)
        var council = map.getLayers().getArray().find(layer => layer.get('title') == 'Council Layers')
        // console.log(council)
        var land = council.getLayers().getArray().find(layer => layer.get('title') == 'Land layers')
        var propeLaya = land.getLayers().getArray().find(layer => layer.get('title') == 'Properties')
        console.log(propeLaya)
        // console.log(map.getLayers().getArray().find(layer => layer.get('name') == 'Properties'))
        if (evt.pixel) {




            // var features = [];
            var feature = map.forEachFeatureAtPixel(evt.pixel, function (feature, layer) {

                //  features.push(feature);
                // 
                if (propeLaya = layer) {


                }
                return true
            })
            alert(feature)
            console.log(feature)
            if (feature) {

                // Apply highlight style to the clicked feature
                //  feature.setStyle(highlightStyle);

                // Save reference to the highlighted feature for later removal
                //  sethighlight = feature;
                var obj = feature.getProperties(), properties
                for (properties in obj) {
                    console.log('<b>' + properties + '</b> : <i><b>' + obj[properties] + '</b></i>                          <br />')
                    // content.innerHTML += '<b>' + propiedades + '</b> : <i><b>' + objeto[propiedades] + '</b></i><br />'
                }
                // overlay.setPosition(coord)
            } else {
                // overlay.setPosition(undefined)
            }
        };
    })

please help me to resolve this matter with react example

New contributor

Saman Tilakaratne is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.