spfx has some utility classes to help. start by import { UrlQueryParameterCollection } from '@microsoft/sp-core-library';
import { UrlQueryParameterCollection } from '@microsoft/sp-core-library'; Then in your onRender:
var queryParameters = new UrlQueryParameterCollection(window.location.href); if (this.properties.mode !== modes.NEW) { if (queryParameters.getValue("Id")) { const id: number = parseInt(queryParameters.getValue("Id")); let fields = "*,ParentTR/Title,Requestor/Title"; // get the requested tr pnp.sp.web.lists.getByTitle("Technical Requests").items.getById(id).expand("ParentTR,Requestor").select(fields).inBatch(batch).get() .then((item) => { I create a 'mode' property on the property pane to specify if the form is in new, edit or display mode. Throw an error if no id is specified in display or edit mode. this example uses pnp-js-core.
hth