In response to a stack overflow question on how to load a topojson file based on a file input.
Click the map to change the source file.
As topojson files often have a filename (without extenstion) that is equal to the name of the property that holds the features, we can use:
d3.json(fileName + ".json", function(error, topo) { ....
... .data(topojson.feature(topo, topo.objects[fileName]).features)
To ensure that these two match, you can check the topojson itself. Though it can be a pain to find. If you can find the word "objects", you can find the property name.
https://d3js.org/d3.v4.min.js
https://d3js.org/d3-geo-projection.v1.min.js
https://d3js.org/topojson.v1.min.js