Advertisement
Guest User

Untitled

a guest
Mar 29th, 2020
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.12 KB | None | 0 0
  1. import React from 'react';
  2. import axios from 'axios';
  3.  
  4.  
  5. export default class CpuList extends React.Component {
  6. state = {
  7. cpus: []
  8. }
  9.  
  10. componentDidMount() {
  11. axios.get(`http://localhost/picker/public/api/cpus`)
  12. .then(res => {
  13. console.log(res.data.data);
  14. this.setState({ cpus:res.data.data })
  15. })
  16. }
  17.  
  18. render() {
  19. return (
  20. // <ul>
  21. // {this.state.cpus.map(cpu => <li>{cpu.name}</li>)}
  22. // </ul>
  23. <div>
  24. {this.state.cpus.map(cpu =>
  25. <div className="surrounding">
  26. <h3>
  27. {cpu.name} - {cpu.id}
  28. </h3>
  29. <div>
  30. <p>Core / Threads : {cpu.core_thread}</p>
  31. </div>
  32. <div>
  33. <p>Base / Boost clocks : {cpu.base_clock} GHz / {cpu.boost_clock} GHz</p>
  34. </div>
  35. </div>
  36. )}
  37. </div>
  38. )
  39. }
  40.  
  41. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement