react#useId JavaScript Examples

The following examples show how to use react#useId. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: index.js    From React-Hooks with MIT License 6 votes vote down vote up
Component = () => {
  const id = useId();
  return (
    <div className='mt-4'>
      <label htmlFor={id}>Hai capito use ID ?</label>
      <input
        className='input-group-text bg-white'
        id={id}
        type='checkbox'
        name='react'
      />

      <div className='mt-4'>
        {tempData.map((data) => {
          return (
            <div
              key={data.text}
              className='card rounded-3 border-1 p-2 mt-1'
              style={{
                borderColor: "#e5e5e5",
              }}
            >
              {data.text}
            </div>
          );
        })}
      </div>
    </div>
  );
}