Iconify for React function: iconExists

This tutorial is part of Iconify for React functions tutorial.

Function iconExists() checks if icon data is available for rendering.


Function has the following parameter:

  • name, string. Icon name.

Function returns boolean value: true if icon is available, false if icon is not available.


import { iconExists, loadIcons, Icon } from '@iconify/react';

function renderLeftArrow() {
   // Check if 'bi:arrow-left' is available
   if (iconExists('bi:arrow-left')) {
       // Return HTML for 'bi:arrow-left'
       return <Icon icon="bi:arrow-left" />;

   // Load icon. Bad example because this should use a callback to re-render arrow in a stateful
   // component, but this code example is about iconExists(), not loadIcons()

   // Return '<'
   return <span>&lt;</span>;