I just did my very first API call for Random Quote Machine. Can anyone see if everything looks good?

I just want it to be as simple as possible so I excluded all the errors and all that were mentioned in the React docs as I know that we will be taught all about APIs later on in the upcoming certifications.

Code pen Link(please only see the JS part)


My code here
class MyComponent2 extends React.Component {
  constructor(props) {
    this.state = {
      quote: "",
      author: ""

  componentDidMount() {
      .then((response) => response.json())
      .then((data) => {
          quote: data.content,
          author: data.author

  render() {
    return <div> Hello World {this.state.quote} {this.state.author} </div>;

ReactDOM.render(<MyComponent2 />, document.getElementById("root"));

Hi @ankurchaulagain !

Your fetch call is correct.

Now you just have to add the functionality for the new quote button.

1 Like

Thanks for your suggestion in the earlier post so glad I figured it out.

From this point onward it’s really easy just add the necessary tags and styling right :relaxed:

Yeah, the first two projects don’t require a lot of code.

It is only the last three, (the last two in particular) that require a lot of code.

1 Like

Thanks for the heads up.

Calculator sounds fun not sure about 25+5 gonna have to see what it is and how it is.

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.