Answer the question
In order to leave comments, you need to log in
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')
)
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question