D3 filter toposon by state id?

I would like to filter the counties in the D3 topojson in the topojson.feature() call by state FIPS

Here’s the relevant code:

.data(topojson.feature(geo, geo.objects.counties).features) // <-- this line would ideally be:
//  .data(topojson.feature(geo, geo.objects.counties.geometries.filter(f => f.id.includes("48")).features) //
  .attr("fill", d => colorScale(turnoutPerc.get(d.id)))
  .attr("d", path)
.on('mousemove', (event,d) => {
    .style('stroke', "#000")
    .style('stroke-width', 2)
    .style('cursor', 'pointer');

Currently, on hover, county geometry shapes in bordering states are visible, since those are technically still being drawn onto the canvas.

    .data(topojson.feature(geo, geo.objects.counties).features).filter(d => d.id.includes("48")) 

doesn’t work either.

Observable notebook here.

Would appreciate if someone could take a look! Thanks!


.data(topojson.feature(geo, geo.objects.counties).features.filter(d => d.id.slice(0, 2) === "48"))