Advertisement
Guest User

Untitled

a guest
Jan 16th, 2019
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. import React, { Component } from 'react';
  2. import axInstance from '../../../axios';
  3. import Students from '../../Students/Students';
  4.  
  5. import classes from './FullCourse.css'
  6.  
  7. class fullCourse extends Component {
  8.   state = {
  9.     course: []
  10.   }
  11.   componentDidMount () {
  12.     axInstance.get(this.props.match.url + '.json')
  13.       .then(response => {
  14.         this.setState({course: response.data})
  15.         console.log(response);
  16.       });
  17.   }
  18.  
  19.   render () {
  20.     return (
  21.       <div className={classes.FullCourse}>
  22.         <h1>{this.state.course.name}</h1>
  23.         <p>{this.state.course.body}</p>
  24.         <p>{this.state.course.startDate}</p>
  25.         <Students list={this.state.course.students ? Object.entries(this.state.course.students) : []}/>
  26.       </div>
  27.  
  28.     )
  29.   }
  30.  
  31. }
  32.  
  33. export default fullCourse;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement