/** * The following 2 questions are intended to measure your progress through the semester. * There is no "correct" answer, and I just want to see how well you can solve them. * Good luck. */ /* * 1. React Component * Create a
component that takes a single prop "type" and renders an html element with that type. * For example: * If the "type" is "h1", then an

tag should be rendered. * The text of the tag should be whatever is passed in between the
and
tags. */ import React, { Component } from 'react'; /** * Define your component here */ class Header extends Component { constructor(props) { super(props); } render() { const MyTag = this.props.type; return ( {this.props.children}); } } class App extends Component { constructor(props) { super(props); } render() { return (
123
); } } export default App; /* * 2. Servers and APIs * Using this URL: https://hn.algolia.com/api/v1/search?query=react&tags=story * Write a simple express program that will accept a request and returns the titles from the API */ var express = require('express'); var app = express(); // Your code goes here var request = require('request') app.get('/', (req, res)) => { fetch('https://hn.algolia.com/api/v1/search?query=react&tags=story'). then( function(response) { response.json().then(data){ var titles = data.map((item) => item.title) res.send(titles); } } ) .catch(function(err) { res.send(err); }); } app.listen(3000, function () { console.log('Example app listening on port 3000!'); });