-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
29 lines (24 loc) · 922 Bytes
/
index.js
File metadata and controls
29 lines (24 loc) · 922 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import {App, Widget1} from './App';
import Widget from './components/Widget.js';
var courses = ['CSE100', 'CSE110', 'CSE20', 'CSE30'];
ReactDOM.render(<App />, document.getElementById('top'));
function addWidget(param) {
{/* This removes any widgets that may be from a different class */}
ReactDOM.unmountComponentAtNode(document.getElementById('bottom'));
{/* Render the course widgets */}
ReactDOM.render(<Widget1 name={param}></Widget1>, document.getElementById('bottom'));
}
ReactDOM.render(
<div className="container-fluid">
<div className="row">
{courses.map((courseTitle, arrayIndex) => {
return (
<button key={arrayIndex} className="Button"
onClick={addWidget.bind(this, courseTitle)}>{courseTitle}</button>
)
})}
</div>
</div>, document.getElementById('buttons'));