Advertisement
sandhysanjaya

talent.js

Jan 25th, 2018
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. import React, { Component } from 'react';
  2. import {Table} from '../../components/common/Table';
  3. import Coba from './Coba';
  4. import axios from 'axios';
  5. class Talent extends Component {
  6.  
  7. constructor(props) {
  8. super(props);
  9. this.state = {
  10. talent: []
  11. }
  12. }
  13.  
  14. componentDidMount(){
  15. var th = this;
  16. axios.get('https://next.json-generator.com/api/json/get/NkmVhBGB4', {
  17. mode: 'no-cors',
  18. headers: {
  19.  
  20. },
  21. }).then(function(result) {
  22. th.setState({
  23. talent: result.data
  24. })
  25. console.log(this.state.talent)
  26. })
  27. }
  28.  
  29. columns = [
  30. {title: "Nama", data: "name"},
  31. {title: "Registered", data: "registered"},
  32. {title: "About", data: "about"}
  33. ]
  34. render() {
  35.  
  36. return (
  37. <div>
  38. <h1> Halaman Awal </h1>
  39. <Coba kolom={this.columns} data={this.state.talent}/>
  40. </div>
  41. );
  42. }
  43. }
  44.  
  45. export default Talent;
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement