i am having trouble pulling an object that i have on state and showing it on my web page. it doesn't exactly matter how it appears on the web page i just want to figure out how to view it so far.
import React, { Component } from 'react';
import {Link} from 'react-router-dom';
import axios from 'axios'
const test = require('../controller')
export default class Calandar extends Component {
constructor(props) {
super(props)
this.state = {
avalable: {},
unavalable: {}
}
}
componentDidMount() {
axios.get('/api/avalable').then(res => {
// console.log(res.data)
this.setState({avalable: res.data})
})
}
render() {
return (
<div>
Calandar.js
<div>
{console.log(this.state.avalable)}
</div>
</div>
);
}
}
this is the array that i have saved by doing a get request from my database.
0: {…}
avalable: true
date: "1-1-1"
dentist: "dentist_test"
id: 1
name: "dentist_test"
office: "test_office"
time: "01:01:01"
mapfunction.