score:0

Can you try accessing it using props.idno in the TogglePosts Component? In the fetch statement you can do something like fetch(`https://jsonplaceholder.typicode.com/posts?userId=${props.idno}`);

score:0

Try this:

const response = await fetch(
        `https://jsonplaceholder.typicode.com/posts?userId= ${this.props.idno}`
      );

Template literal(``) is the ability to include expressions and variables within a string.

score:1

You can try editing your response similar to this.

    const response = await fetch(
        `https://jsonplaceholder.typicode.com/posts?userId= ${this.props.idno}`
      );

Note that I've used `(tilde) instead of "(double quotes) Also use props instead of prop


Related Query

More Query from same tag