Latest news:

New android application Islamic Video has been released. its a free islamic video application for android smartphone. Download now!

Pagination in react by react-paginate

Pagination in react by react-paginate


A ReactJS component to render a pagination.

By installing this component and writing only a little bit of CSS you can obtain this:


Install react-paginate with npm:

$ npm install react-paginate --save

To use this we need to import it

import ReactPaginate from 'react-paginate';

You will quickly understand how to make react-paginate work with a list of objects by below code.

< ReactPaginate
                 subContainerClassName={'pages pagination'}
/ >

Read full documentation here

Views: 58

How to insert HTML in react js?

How to insert HTML in react js?

In react project sometimes need to show raw HTML content. React simply does not allow us to put raw HTML content.
In that case we need to use dangerouslySetInnerHTML dom element in order to resolve that issue. For example

render: function() {
    return (
        <div className="myClassName" dangerouslySetInnerHTML={{__html: this.state.cms_info.content}}>div>

Please keep in mind that
dangerouslySetInnerHTML  can be dangerous if you do not know what is in the HTML string you are adding, sometimes malicious client side code can be injected via script tags.

Views: 73

Subscribe Us

Follow Us