Skip to content

Instantly share code, notes, and snippets.

@kevgathuku
Created June 25, 2019 06:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kevgathuku/9c518adab0fd4854a61a5c6d3cac0a37 to your computer and use it in GitHub Desktop.
Save kevgathuku/9c518adab0fd4854a61a5c6d3cac0a37 to your computer and use it in GitHub Desktop.
Embedding Elm 0.19 into a React app using react-elm-components
import React from 'react';
import logo from './logo.svg';
import './App.css';
// Add these two imports
import Elm from 'react-elm-components';
import Main from "./Main";
function App() {
return (
<div className="App">
<header className="App-header">
<img src={logo} className="App-logo" alt="logo" />
<p>
Edit <code>src/App.js</code> and save to reload.
</p>
<a
className="App-link"
href="https://reactjs.org"
target="_blank"
rel="noopener noreferrer"
>
Learn React
</a>
{/* The following line renders the Elm app just like a React component */}
<Elm src={Main.Elm.Main} />
</header>
</div>
);
}
export default App;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment