Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import '../App.css';
- import React, { Component } from 'react';
- import Tabela from './Tabela';
- class App extends Component{
- constructor(){
- super();
- this.state=({
- db: []
- });
- this.exibirCarros();
- }
- exibirCarros(){
- fetch("http://localhost/Api/classConexion.php")
- .then((response)=>response.json())
- .then((responseJson)=>
- {
- this.setState({
- db: responseJson
- });
- })
- }
- render(){
- return(
- <div>
- <Tabela arrayCarros={this.state.db } />
- </div>
- );
- }
- }
- export default App;
- .then((response)=>response.json())
- class App extends Component{
- constructor(){
- super();
- this.state= {
- db: []
- };
- }
- componentDidMount(){
- fetch("http://localhost/Api/classConexion.php")
- .then( response => response.text())
- .then( text => console.log(text));
- }
- render(){
- return(
- <div>
- <Tabela arrayCarros={this.state.db } />
- </div>
- );
- }
- }
Add Comment
Please, Sign In to add comment