M
M
Maxim Kaygorodov2019-02-15 19:05:39
React
Maxim Kaygorodov, 2019-02-15 19:05:39

How to render from React component to different html pages?

There is an index js

import React from 'react'
import {render} from 'react-dom'
import Hello from './components/Hello'

render (<Hello/>, document.getElementById('root'))

There is Hello.js
import React from 'react'


function Hello() {
    return (
    <h1>
       Hello 
    </h1>
    )
}

export default Hello

The component is rendered in index.html, but I need it to be rendered in another .html file (there is a div#root).
How to do it?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexey Laud, 2019-02-15
@kshshe

Just include the same js that is connected to index.html and to other pages.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question