Help with my react

I think I’m missing an error or not using React properly? Why is my content not rendering?
https://codepen.io/freeCodeCamp/pen/MJjpwO

@brandenhintz Your code pen is just a starting template. You need to save the pen first.

What does the browser console show? Are there any errors?

nope, no errors in the console from my code. Just nothing.

You will need to post a link to a pen that actually has content. The one you originally supplied does not have any code.

Wow… sorry. Here is the correct link;

https://codepen.io/bhintz/pen/ZEGaMNa?editors=1111

@brandenhintz You have three issues I see right off the start:

  1. You try to declare a function inside the class:
function act(n){
  const text = sounds[n];
  const sound = clips[n];
  this.setState(()=>{
    return {display: text}
  })
  const clip = new Audio(sound)
  clip.play()  
}

I think you meant to create method here, so correct that.

  1. There is no such method class ReactDom. You have a small typo here. Fix that and something will render.

  2. You display the name of the sound to the display, but you can not see it, because it has the same color text as the color of the display background.

1 Like