Tell us about your environment:
- Software/Script version: create-react-app
- Platform / OS version: linux 64 bit
- URLs (if applicable): Nai.
What steps will reproduce the problem?
Please include code that reproduces the issue.
- < h1 >{this.state.githubData.name}</ h1 >
- this.state = this.state.githubData.bind(this)
What is the expected result? Print My gthub profile name using github api.
What happens instead?
- when i add "< h1 >{this.state.githubData.name}</ h1 >" this line its gives me an error "this.state.githubData.name is undefined".
- when i open react dev tool. there is a option called state. and there store all my github data story. but it doesent print using state.
Internet Search Result:
- I copy this line "this.state is undefined" and search google they tell me to bind this.state
- when i bind this.state like this "this.state = this.state.githubData.bind(this);" then i got an new error "TypeError: _this.state.githubDada is undefined".
Github Repository: https://github.com/Jobayer-Ahmed/ReactGithubAPI
Always read first. Learn markdown. And also share screenshots.
Learn how to share images and codes inside markdown.
Anyway, the problem is here,
Here,
this
applies only to that scope.I shared a screenshot in the group chat.
Do you see how I used reference instead of this?
So how can you solve this problem?