U
U
uzi_no_uzi2018-12-16 15:40:42
JavaScript
uzi_no_uzi, 2018-12-16 15:40:42

How to properly use React-router in my cases?

Such a situation: There is an index.html main page, it does not use React at all, on the main page there is a link to a page that uses React.
I need to display my app on a page that uses React, but apparently webpack is configured to only look for the container in index.html. I was advised to use React-router, I read a little about this in the book, but it says a little about something else, it says about displaying a certain component on the page depending on the page address. This is not exactly what I need.

import React from 'react';
import ReactDOM from 'react-dom';

import ElectronApp from './components/ElectronApp';

import {
  HashRouter,
  Route
} from 'react-router-dom'


ReactDOM.render(
  <HashRouter>
    <Route path="/electron-game.html" component={ElectronApp} />
  </HashRouter>,
  document.getElementById('root')
)

Here is my code, it naturally does not work as it should, all I need is for the application to be displayed not in index.html, but in electron-game.html, is it possible to do this?

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question