Solution

To create checkbox using ant design in react js, first install ant design library using npm install antd command import and use the checkbox component from it. Whenever checkbox input is checked or unchecked then onchange function is triggered.

Snippet

In this snippet, see small example for using Checkbox component of Ant design library, with use of onChange={onChange} attribute.

<Checkbox onChange={onChange}>Checkbox</Checkbox>;

Example

In this example, we will import the Checkbox component from the ant library. checkbox input is checked or unchecked then onchage function is clicked.

Let’s start coding…

App.js

import { Checkbox } from 'antd';
const onChange = (e) => {
  console.log(`checked = ${e.target.checked}`);
};
const App = () =>
  <Checkbox onChange={onChange}>Checkbox</Checkbox>;
export default App;

Output

Ant-design, checkbox

Here, we are provided code sandbox links for the above program to create checkbox using ant design. Then you can use whenever you went and do the changes as per your requirements

codesandbox

Happy Coding,

I hope the above example with help you to do your task.