import React from 'react'; import logo from './logo.svg'; import './App.css'; export default class App extends React.Component { constructor(props) { super(props); this.state = { festivals: null , fetched:false, }; } fetchFestivals=()=>{ fetch('http://localhost/drupalmod2/festivals?_format=json', { method: 'get', headers: {'Content-Type': 'application/json'} }).then(response=>response.json()).then(data=>{if(data)this.setState({fetched:true,festivals:data})}) } componentDidMount=()=>{ this.fetchFestivals(); } render(){ console.log(this.state.festivals) return (

A PWA with Headless Drupal

Festivals

{this.state.fetched&&this.state.festivals&&this.state.festivals.map((item)=>{ return(

{item.title[0].value}

{item.body[0].value.substring(3,(item.body[0].value.length-12))}
) })}
) } }