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: 72

Remove apostrophe in string

Have a look at

I believe that it will work OK if you escape the ' character thus: '
You can easily create a Javascript function to replace each instance of ' by '.

str = str.replace(/'/g, "\'");

Views: 3718

SyntaxError: expected expression, got '<'

Assumption here is that you're referencing the script incorrectly and the web server is serving a 404 html page. Make sure the js file is where you're referencing it from.

for reference

Views: 4104

Subscribe Us

Follow Us