CodeWithHarry / NewsMonkey-React

News App created using React and NewsAPI
268 stars 205 forks source link

Next button not working .Please help #30

Open Abhishek00user opened 1 year ago

Abhishek00user commented 1 year ago

import NewsItem from './NewsItem'

export class News extends Component { articles = [ { "source": {"id": "news24", "name": "News24"}, "author": "Sibusiso Mjikeliso", "title": "Cricket SA wants to 'get to the bottom' of Nkwe resignation concerns, says CEO | Sport", "description": "Acting Cricket South Africa CEO Pholetsi Moseki says the board is concerned about the issues former Proteas assistant coach Enoch Nkwe raised in his resignation.", "url": "https://www.news24.com/sport/Cricket/Proteas/cricket-sa-wants-to-get-to-the-bottom-of-nkwe-resignation-concerns-says-ceo-20210826", "urlToImage": "https://cdn.24.co.za/files/Cms/General/d/10743/97d776dc91734e98906c0e1b7f3b1afa.jpg", "publishedAt": "2021-08-26T11:40:16+00:00", "content": "

AnuravModak commented 10 months ago

is this still open for contributions???

PRAKALP-PANDE commented 9 months ago

Button styling

<div className="container d-flex justify-content-between">
          <button disabled={this.state.page <= 1} type="button" className="btn btn-dark" onClick={this.handlePrevClick} >&laquo; Previous</button>
          <button disabled={this.state.page >= 5} type="button" className="btn btn-dark" onClick={this.handleNextClick} >Next &raquo; </button>
        </div>

Function for previous button

         const handlePrevClick = async () => {
    setpage(page-1)
    updateNews();
  }

Function for Next button

  const handleNextClick = async () => {
    setpage(page+1)
    updateNews();
  }

I hope this may help you.