Day 26
Today is my first ever venture into React.JS... Thank you Brad Traversy.
#CodingPhase #TheCodingWay #365CodingPhaseChallenge
**********
import React, { Component } from 'react';
import uuid from 'uuid';
import $ from 'jquery';
import Projects from './Components/Projects';
import AddProject from './Components/AddProject';
import Todos from './Components/Todos';
import './App.css';
class App extends Component {
constructor(){
super();
this.state = {
projects: [],
todos:[]
}
}
getTodos(){
$.ajax({
url: 'https://jsonplaceholder.typicode.com/todos',
dataType:'json',
cache: false,
success: function(data){
this.setState({todos: data}, function(){
console.log(this.state);
});
}.bind(this),
error: function(xhr, status, err){
console.log(err);
}
});
}
#CodingPhase #TheCodingWay #365CodingPhaseChallenge
**********
import React, { Component } from 'react';
import uuid from 'uuid';
import $ from 'jquery';
import Projects from './Components/Projects';
import AddProject from './Components/AddProject';
import Todos from './Components/Todos';
import './App.css';
class App extends Component {
constructor(){
super();
this.state = {
projects: [],
todos:[]
}
}
getTodos(){
$.ajax({
url: 'https://jsonplaceholder.typicode.com/todos',
dataType:'json',
cache: false,
success: function(data){
this.setState({todos: data}, function(){
console.log(this.state);
});
}.bind(this),
error: function(xhr, status, err){
console.log(err);
}
});
}
Comments
Post a Comment