Created
June 25, 2019 06:03
-
-
Save kevgathuku/9c518adab0fd4854a61a5c6d3cac0a37 to your computer and use it in GitHub Desktop.
Embedding Elm 0.19 into a React app using react-elm-components
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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