We often get involved in building web applications where we need to fetch large sets of data records from a remote server, API, or a database. If you are building a payment system, for example, it could be fetching thousands of transactions. If it is a social media app, it could be fetching many user comments, profiles, or activities. Whatever the case may be, there are several solutions for presenting the data in a manner that does not overwhelm the end-user interacting with the app.

One method for handling large datasets is using Pagination. Pagination works effectively when you already…


The call, bind and apply methods can be used to set the this keyword independent of how a function is called. The bind method creates a copy of the function and sets the this keyword, while the call and apply methods sets the this keyword and calls the function immediately.

  • Call invokes the function and allows you to pass in arguments one by one.
  • Apply invokes the function and allows you to pass in arguments as an array.
  • Bind returns a new function, allowing you to pass in a this array and any number of arguments.

Call

Call invokes the function…


Jest is a delightful JavaScript Testing Framework with a focus on simplicity.

It works with projects using: Babel, TypeScript, Node, React, Angular, Vue and more!

To start with Jest, try installing it using below commands, with supported libraries —

Save it as a dev dependency in your package.json, so that your production build is light weighted. Then, to run test add below script in package.json

“test”: “cross-env NODE_ENV=test jest — coverage — silent”,

To run test cases deleting and creating all new snapshots, use below command —

Then create a Component, for e.g. — Button.js

Then…

Mohit Khandelwal

Experienced Software Engineer with skilled in React JS, JavaScript, HTML, CSS and Jest. Working as a Senior Technical Consultant at Xebia.

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store