I am currently trying to fetch data from a JSON file and get it to render to a researchPage. Nothing I do seems to be working. I would like to fetch the data and put it into some sort of a table or visualization. Please let me know what I might be doing wrong. I am currently receiving the following error:
TypeError: Cannot read property ‘map’ of undefined
In the data directory I have
damon-data.json (this is a large file and would be impossible to place here, so I am placing a small portion)
{
"hits": [
{
"_index": "issflightplan",
"_type": "issflightplan",
"_key": "IDP-ISSFLIGHTPLAN-0000000000000447",
"_version": 1,
"_score": null,
"ContentType": {
"__deferred": {
"uri": "https://bi.sp.iss.nasa.gov/Sites/FP/_api/Web/Lists(guid'a9421c5b-186a-4b14-b7b2-4b88ee8fab95')/Items(252)/ContentType"
}
then in the same directory I have
data.js – My thought was that I would fetch the data here and pass it to the research page using props
import React, {Component} from 'react';
import data from '../data/damon-data.json'
import axios from 'axios';
class Data extends Component {
constructor(props) {
super(props);
this.state = ({
dataSet: []
})
}
componentDidMount() {
let url = data;
axios.get(url)
.then(response => {
console.log(response.data.hits)
this.setState({
dataSet: response.data.hits
})
})
.catch(error => {
console.log(error)
})
}
}
researchPage.js – This is where the data should render (once I get it to render here I thought I could begin working to place it into a table. Unless there is a better way to go about it.
import React, { Component } from "react";
class researchPage extends Component {
constructor(props) {
super(props);
}
render() {
return(
<div>
{this.props.data.map((dataSet, index) => (
return <p>{dataSet.hits}</p>
))}
</div>
)
}
}
export default researchPage
App.js
import React, {Component} from 'react';
import {BrowserRouter, Route, Switch} from 'react-router-dom';
import './App.css';
import Navbar from "./components/menu/navbar";
import Home from './pages/home/home'
import Explore from './pages/explore/explore'
import search from './pages/search/search'
import researchPage from "./pages/researchPage/reasearchPage";
import Query from './pages/query/query'
import Visualize from "./pages/visualize/visualize";
import Analyze from "./pages/analyze/analyze";
import Configure from "./pages/configure/configure";
class App extends Component{
render() {
return(
<BrowserRouter>
<div>
<Navbar/>
<Switch>
<Route path="/" component={Home} exact/>
<Route path="/explore" component={Explore} exact/>
<Route path="/search" component={search} exact/>
<Route path="/query" component={Query} exact/>
<Route path="/visualize" component={Visualize} exact/>
<Route path="/analyze" component={Analyze} exact/>
<Route path="/configure" component={Configure} exact/>
<Route path="/research" component={researchPage} exact/>
</Switch>
</div>
</BrowserRouter>
)
}
}
export default App;
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import reportWebVitals from './reportWebVitals';
ReactDOM.render(
<React.StrictMode>
<App />
</React.StrictMode>,
document.getElementById('root')
);
reportWebVitals();
modafinil 100 mg – buy modafinil online provigil generic
buy amoxicillin noscript canada – buy amoxicilina noscript canada amoxicillin without prescription
ivermectin lotion for scabies – ivermectin price uk price of ivermectin tablets
tadalafil 5mg – cialis 20mg price in usa generic cialis sale
buy ivermectin cream for humans – ivermectin cost canada order stromectol
online accutane – where to get accutane prescription accutane.com
amoxicillin over counter – buy amoxicillina noscript canada amoxicillin on line
how to buy viagra online in australia – ed drugs compared viagra 100 mg tablets
buy generic cialis online – buy tadalafil no prescription cialis 100mg india
cost stromectol – stromectol 15 mg where to buy ivermectin
prednisone 216 – order prednisone 10 mg tablet order prednisone online safely
provigil 100 mg – provigil generic modafinil 200 mg
order zithromax 250mg – buy azithromycin 250mg zithromax for sale
furosemide 20 mg tabs – furosemide 20mg tablet cost furosemide tablets for sale uk
cialis coupon – Buy generic cialis tadalafil 10mg prices uk
You should be a part of a contest for one of the highest
quality blogs on the web. I’m going to recommend this web
site!
cialis rx cost – cost of 10mg tadalafil pills cheap tadalafil 60 mg
I quite like reading an article that will make men and women think.
Also, thank you for permitting me to comment!
Write more, thats all I have to say. Literally,
it seems as though you relied on the video to make
your point. You clearly know what youre talking about, why
waste your intelligence on just posting videos to your weblog when you could be giving us something informative to read?
This web site definitely has all of the information I wanted about this subject and didn’t know who
to ask.
If you wish for to get a great deal from this post then you have to apply such methods to
your won web site.
Hi there, just wanted to mention, I loved this
blog post. It was inspiring. Keep on posting!
buy amoxicillin noscript canada – amoxicillin sleep walmart price for amoxicillin
This website definitely has all of the information and facts
I wanted concerning this subject and didn’t know who to ask.
It’s going to be ending of mine day, but before ending
I am reading this impressive piece of writing to increase my knowledge.
lasix 40 mg tablet online buy lasix without a prescription nek nox
furosemide 80 mg frusemide tablets 40mg nek nox
Ahaa, its nice dialogue regarding this post at this place at this weblog, I have read all that, so now me
also commenting at this place. quest bars http://bit.ly/3C2tkMR quest bars
Fantastic site. Lots of helpful information here. I am sending it to some friends ans additionally sharing in delicious.
And certainly, thank you for your sweat! scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery
It’s actually very complicated in this busy life to listen news on Television, thus I
just use world wide web for that reason, and get the most recent information. cheap
flights http://1704milesapart.tumblr.com/ cheap flights
Pretty! This has been a really wonderful post.
Many thanks for supplying this info. scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery
It’s awesome to pay a visit this site and reading the views of all
friends regarding this article, while I am also keen of getting familiarity.
quest bars https://www.iherb.com/search?kw=quest%20bars quest bars
cost of doxycycline canada – prednisolone 25mg australia prednisolone uk
ivermectin lice oral purchase oral ivermectin
clomid over the counter nek nox
clomid 100mg price nek nox
where to buy ivermectin pills ivermectin oral solution
cost of stromectol medication ivermectin for sale humans
hydroxychloroquine and psoriasis – prednixone tables for sale purchase prednisone
tadalafil 5 mg for sale – fda approved cialis where to buy cialis online no prescription
stromectol where to buy – ivermectin oral ivermectin 12
viagra vs cialis cuanto cuesta cialis en farmacia cialis en farmacias sin receta ВїcuГЎl es la mejor viagra o cialis?
canadian viagra and healthcare – us cialis sales buy tadalafil 5mg online cheap
viagra 100mg sans ordonnance – acheter tadalafil en ligne tadalafil 5mg pas cher
ivermectin brand name – top erection pills stromectol 6mg online
prednisone 20mg us – cheap erectile dysfunction pills order prednisone 10mg online
where to buy generic cialis online safely side effects for tadalafil
buy propranolol online – purchase inderal generic order hydroxychloroquine 200mg for sale
generic cialis online fast shipping tadalafil cialis
tadalafil side effects for tadalafil
https://cialismat.com/ generic cialis tadalafil
where to get tadalafil cheap generic cialis for sale
tadalafil drug buy generic cialis online with mastercard
tadalafil order online no prescription https://nextadalafil.com/
buy tadalis tadalafil goodrx
tadalafil daily online cialis at canadian pharmacy
https://cialisedot.com/ tadalafil online
stromectol 12 mg
buy ivermectin online
buy stromectol 3 mg tablets cheapest stromectol online
buy ivermectin usa generic stromectol 12 mg stromectol 6 mg