So I have an assignment that requires me to create a React application in only one js/jsx file. This requirement has become quite frustrating for me and I have no idea why it exists in the firs place because I can't figure out the syntax to do something like this. Here is my code:
import React, { PureComponent } from 'react';
import ReactDOM from 'react-dom';
import * as serviceWorker from './serviceWorker';
ReactDOM.render(
<div className="centerContent">
<div className="container">
<div className="row">
<div className="col-6" style={{fontSize: "1vw"}}>
<div id="starWarsBanner"></div>
<div id="data-col-1">
Data loading...
</div>
<button type="button" onClick="getStarWarsData" className="btn btn-success btn-lg" id="getNewStarWarsData">Get New Star Wars Character</button>
</div>
<div className="col-6" style={{fontSize: "1vw"}}>
<div id="pokemonBanner"></div>
<div id="data-col-2">
Data loading...
</div>
<button type="button" onClick="getPokemonData" className="btn btn-success btn-lg" id="getNewPokemonData" style={{marginTop: "10px"}}>Get New Pokemon</button>
</div>
</div>
</div>
</div>, document.getElementById('root'));
In the Data loading... html sections I'd like to ideally put another component to render information from these two apis:
That's really the only requirement but I can't figure out how to do this using only one file. Help please!