Guest User

Untitled

a guest
Jul 19th, 2018
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.06 KB | None | 0 0
  1. import '../App.css';
  2. import React, { Component } from 'react';
  3. import Tabela from './Tabela';
  4.  
  5. class App extends Component{
  6.  
  7. constructor(){
  8. super();
  9. this.state=({
  10. db: []
  11. });
  12. this.exibirCarros();
  13. }
  14.  
  15. exibirCarros(){
  16. fetch("http://localhost/Api/classConexion.php")
  17. .then((response)=>response.json())
  18. .then((responseJson)=>
  19. {
  20. this.setState({
  21. db: responseJson
  22. });
  23. })
  24. }
  25.  
  26. render(){
  27. return(
  28. <div>
  29. <Tabela arrayCarros={this.state.db } />
  30.  
  31. </div>
  32. );
  33. }
  34. }
  35.  
  36. export default App;
  37.  
  38. .then((response)=>response.json())
  39.  
  40. class App extends Component{
  41. constructor(){
  42. super();
  43. this.state= {
  44. db: []
  45. };
  46. }
  47. componentDidMount(){
  48. fetch("http://localhost/Api/classConexion.php")
  49. .then( response => response.text())
  50. .then( text => console.log(text));
  51. }
  52. render(){
  53. return(
  54. <div>
  55. <Tabela arrayCarros={this.state.db } />
  56. </div>
  57. );
  58. }
  59. }
Add Comment
Please, Sign In to add comment