The code that I'm working with has controllers in the backend Groovy code which render GSP (Groovy Server Pages). And for the frontend we're using react-router v4 to handle routes. The problem I'm encountering is that by defining a route in react-router, it doesn't allow the browser to fetch anything from the backend and just doesn't render a component (because the template is defined in the backend for that route and not in the frontend).
For example:
<button onClick={() => this.props.history.push('/somethingThatShouldBeRenderedByTheFrontend')}>Render from the frontend</button>
<button onClick={() => this.props.history.push('/somethingThatShouldBeRenderedByTheBackend')}>Render from the backend</button>
And when "Render from the frontend" is clicked, that should render "FrontendReactComponent", but when "Render from the backend" is clicked, it should let Groovy controller called "XYZ" should be hit, which in turn renders a GSP page. I couldn't find the proper terminology to research this problem online. Anyone know what I can search for, or how I can solve this problem?
EDIT: Found more info about this problem here (along with a solution): React-router urls don't work when refreshing or writting manually