2

I need to load HTML file (home) into home JavaScript file using react. I don't know how to load my file.Please help me on this. I have used below code for load in JS file

import React from 'react';
import template  from '../home/home.html';
const Home = () => {
    return (
      template()
    );
}

export default Home;

Kane William
  • 21
  • 1
  • 2
  • https://reactjs.org/docs/introducing-jsx.html React is using jsx however if you want to store dom element inside a tag you could stringify it – Fabien Greard May 24 '18 at 12:53
  • 2
    Possible duplicate of [React: how to load and render external html file?](https://stackoverflow.com/questions/40108843/react-how-to-load-and-render-external-html-file) – zwippie May 24 '18 at 12:59
  • this is an idea for webpack loader that loads html as a react component, not sure it's useful though – Evgeny Timoshenko May 24 '18 at 13:00

0 Answers0