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:

svg.append("g")
.selectAll("path")
.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) //
.join("path")
  .attr("fill", d => colorScale(turnoutPerc.get(d.id)))
  .attr("d", path)
.on('mousemove', (event,d) => {
  d3.select(event.currentTarget)
    .raise()
    .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.

svg.append("g")
    .selectAll("path")
    .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!

Solution:

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