last day (24 days later) » 

3:21 AM
1
A: TypeError: Cannot read property 'map' of undefined at View.render (app.js:70994)

Mohamed Allalthis.state.rssreads.map(rssreads => { this is the line you are talking ***about!!! Undefined. Even though you set it in the constructor to an empty array  []. That can mean but only one thing. You are screwing it somewhere. In such a situation the fastest way to find the culprit is to CTRL+f and...

 
componentDidMount() { axios.get('/view').then(response => { console.log(response.data.data); // showed undefined this.setState({ rssreads: response.data.data, activePage: response.data.current_page, itemsCountPerPage: response.data.per_page, totalItemsCount: response.data.total, }); }); }
 
also if it's normal for response.data.data to be undefined! Then you can do something like that this.setState({rssreads: response.data.data || [], ....}) And it's more easier to use {...this.state, rssreads: ......} because later if you add more props to the state, you'll not need to go through all the setState calls !!!!!
 
Mohamed Allal can u please update the code and make code and correct it for me because I don't understand it completely I am an absolute beginner in react :(
 
I can help you in real time! It would be faster and better! And you have choice between chat here or telegram! or discord whatever you find better! That way i can show you better! Besides react! You have a problem with the fetch itself!!! response.data.data
How to turn this into chat !!
Here a room for that you can join! chat.stackoverflow.com/rooms/200480/…
 
Allal I dnt have 20 reputations to join chat room.. i am new in stackoverflow
 
3:21 AM
----------------> even in public ?
Then do you have telegram or something ! Cause everything was explained. You should be good to go. Also have you fixed the problem of your data fetching !!
And please be real time
 
can u do it by teamviewer?
am unable to solve datafetching
no i dnt have telegram
ok installing telegram
Oh, Thanks Allal I got it..Thanks for helping me :) Solved by changing like ({rssreads: response.data.data || [], ....})
 
Ok that's nice! If you need me to clear things up. You can join me at telegram. and for all here besides the data fetching !! YOU do that setState({...this.state, rssreads: myData || [], otherProp: oneAfterAnotherButOnlyTheOneThatYouNeedToReset) // cauuse ...this.state grab them for us (and ...this.state is the spread operator. In that usage it allow easy merge! Equivalent is Object.assign({}, this.state, {rssreads: myData, ..}); search for spread operator and Object.assign if youu don't know them yet !!!
You can accept the answer too !
Look at the update too !
If you find any problem tell me. And it's great to strengthen more your js and es6 knowledge. Also get more familiar or more experience with debugging. I hope you the best.
 
Ok Thanku so much
 
My pleasure. And i hope you the best
 

last day (24 days later) »