Previously, in react-router-dom v5 (or below) you could use:
<Route path="/" render={() => {doSomething(); return <ComponentName />}} />
to both fire a function and create a route without having to create any extra code inside of the ComponentName component. With render
being replaced with element
in v6, how do you now accomplish this?