import React from 'react' import './Name.scss' // partially converted to be like https://reactjs.org/docs/faq-ajax.html // export default (props) => { class MyComponent extends React.Component { constructor(props) { super(props); this.state = { time: null, timeClass: 'Time', isLoaded: false, items: [] }; } // let time = props.time; // let timeClass = 'Time'; componentDidMount() { fetch("https://acicchetti.dev/crossword/v1/2019-10-25") .then(res => res.json()) .then( (result) => { console.log(result) // this.setState({ // isLoaded: true, // items: result.items // }); }, // Note: it's important to handle errors here // instead of a catch() block so that we don't swallow // exceptions from actual bugs in components. (error) => { this.setState({ isLoaded: true, error }); } ) } if (time === "7:00") { time = 'n/a'; timeClass = 'Time no' }; render() { } ); }