react-unique-ids
v1.0.0
Published
Generate unique IDs in React.js
Downloads
18
Readme
��#� �R�e�a�c�t� �U�n�i�q�u�e� �I�D�S�
�
�
�
��R�e�a�c�t� �U�n�i�q�u�e� �I�D�S�
� �i�s� �a� �h�a�n�d�y� �t�o�o�l� �f�o�r� �R�e�a�c�t� �d�e�v�e�l�o�p�e�r�s�.� �I�t� �h�e�l�p�s� �c�r�e�a�t�e� �s�p�e�c�i�a�l� �I�D�s� �f�o�r� �e�l�e�m�e�n�t�s� �i�n� �y�o�u�r� �R�e�a�c�t� �a�p�p�s�.� �Y�o�u� �c�a�n� �c�u�s�t�o�m�i�z�e� �t�h�e�s�e� �I�D�s� �t�o� �s�u�i�t� �y�o�u�r� �n�e�e�d�s� �e�a�s�i�l�y�.� �I�t�'�s� �g�r�e�a�t� �f�o�r� �m�a�n�a�g�i�n�g� �I�D�s� �w�i�t�h�i�n� �R�e�a�c�t� �c�o�m�p�o�n�e�n�t�s�,� �m�a�k�i�n�g� �y�o�u�r� �d�e�v�e�l�o�p�m�e�n�t� �p�r�o�c�e�s�s� �s�m�o�o�t�h�e�r�
�
�<�b�r� �/�>�<�b�r�>�
�
�
�
�#�#�#� �I�n�s�t�a�l�l�a�t�i�o�n� �&� �U�s�a�g�e�
�
�
�
�-� �T�o� �i�n�s�t�a�l�l� �a�n�d� �s�e�t� �u�p� �t�h�e� �l�i�b�r�a�r�y�,� �r�u�n�:�
�
�
�
� � ��
��b�a�s�h�
�
� � �n�p�m� �i�n�s�t�a�l�l� �r�e�a�c�t�-�u�n�i�q�u�e�-�i�d�
�
� � �
��
�
�
�
�
�-� �i�m�p�o�r�t� �t�h�e� �l�i�b�r�a�r�y�
�
� � ��
��j�s�x�
�
� � �i�m�p�o�r�t� �r�e�a�c�t�U�n�i�q�u�e�I�d� �f�r�o�m� �"�r�e�a�c�t�-�u�n�i�q�u�e�-�i�d�"�;�
�
� � �
��
�
�
�-� �U�s�e� �i�t�
�
� � ��
��j�s�x�
�
� � �r�e�a�c�t�U�n�i�q�u�e�I�d�(�)�;�
�
� � �
��
�
�
�
�
�-�-�-�
�
�
�
�#�#� �C�u�s�t�o�m�i�z�a�t�i�o�n�
�
�
�
�-� �T�o� �g�e�n�e�r�a�t�e� �a� �u�n�i�q�u�e� �I�D�,� �s�i�m�p�l�y� �c�a�l�l� �t�h�e� �f�u�n�c�t�i�o�n�:�
�
�
�
� � ��
��j�s�x�
�
� � �r�e�a�c�t�U�n�i�q�u�e�I�d�(�)�;�
�
� � �
��
�
�
�
�
� � �O�u�t�p�u�t�:� �A� �u�n�i�q�u�e� �I�D� �i�s� �g�e�n�e�r�a�t�e�d� �w�i�t�h� �a� �l�e�n�g�t�h� �o�f� �2�0� �c�h�a�r�a�c�t�e�r�s�,� �c�o�n�t�a�i�n�i�n�g� �u�p�p�e�r�c�a�s�e� �l�e�t�t�e�r�s�,� �l�o�w�e�r�c�a�s�e� �l�e�t�t�e�r�s�,� �n�u�m�b�e�r�s�,� �a�n�d� �s�y�m�b�o�l�s�.�
�
�
�
� � ��
��j�s�x�
�
� � �"�b�m�Y�Z�W�C�*�9�D�u�L�N�x�B�@�z�c�d�5�m�"�;�
�
� � �
��
�
�
�
�
� � �<�b�r�>�
�
�
�
�-� �T�o� �s�p�e�c�i�f�y� �t�h�e� �l�e�n�g�t�h� �o�f� �t�h�e� �I�D�,� �p�a�s�s� �t�h�e� �d�e�s�i�r�e�d� �l�e�n�g�t�h� �a�s� �a�n� �a�r�g�u�m�e�n�t�:�
�
�
�
� � ��
��j�s�x�
�
� � �r�e�a�c�t�U�n�i�q�u�e�I�d�(�1�5�)�;�
�
� � �
��
�
�
�
�
� � �O�u�t�p�u�t�:� �A� �u�n�i�q�u�e� �I�D� �i�s� �g�e�n�e�r�a�t�e�d� �w�i�t�h� �a� �l�e�n�g�t�h� �o�f� ��1�5�
� �c�h�a�r�a�c�t�e�r�s�,� �c�o�n�t�a�i�n�i�n�g� �u�p�p�e�r�c�a�s�e� �l�e�t�t�e�r�s�,� �l�o�w�e�r�c�a�s�e� �l�e�t�t�e�r�s�,� �n�u�m�b�e�r�s�,� �a�n�d� �s�y�m�b�o�l�s�.�
�
�
�
� � ��
��j�s�x�
�
� � �"�N�F�7�&�4�q�#�9�F�@�p�J�H�4�o�"�;�
�
� � �
��
�
�
�
�
� � �<�b�r�>�
�
�
�
�-� �Y�o�u� �c�a�n� �c�u�s�t�o�m�i�z�e� �t�h�e� �c�h�a�r�a�c�t�e�r� �r�e�q�u�i�r�e�m�e�n�t�s� �b�y� �p�a�s�s�i�n�g� �a�n� �o�b�j�e�c�t�:�
�
�
�
� � ��
��j�s�x�
�
� � �c�o�n�s�t� �d�a�t�a� �=� �{�
�
� � � � �l�e�n�g�t�h�:� �1�0�,�
�
� � � � �u�p�p�e�r�c�a�s�e�:� �t�r�u�e�,� �/�/� �t�r�u�e� �i�f� �y�o�u� �n�e�e�d� �u�p�p�e�r�c�a�s�e� �l�e�t�t�e�r�s� �i�n� �t�h�e� �u�n�i�q�u�e� �I�D�
�
� � � � �l�o�w�e�r�c�a�s�e�:� �f�a�l�s�e�,� �/�/� �t�r�u�e� �i�f� �y�o�u� �n�e�e�d� �l�o�w�e�r�c�a�s�e� �l�e�t�t�e�r�s� �i�n� �t�h�e� �u�n�i�q�u�e� �I�D�
�
� � � � �s�y�m�b�o�l�:� �f�a�l�s�e�,� �/�/� �t�r�u�e� �i�f� �y�o�u� �n�e�e�d� �s�y�m�b�o�l� �l�e�t�t�e�r�s� �i�n� �t�h�e� �u�n�i�q�u�e� �I�D�
�
� � � � �n�u�m�b�e�r�:� �t�r�u�e�,� �/�/� �t�r�u�e� �i�f� �y�o�u� �n�e�e�d� �n�u�m�b�e�r� �l�e�t�t�e�r�s� �i�n� �t�h�e� �u�n�i�q�u�e� �I�D�
�
� � �}�;�
�
�
�
� � �r�e�a�c�t�U�n�i�q�u�e�I�d�(�d�a�t�a�)�;�
�
� � �
��
�
�
�
�
� � �O�R�
�
�
�
� � ��
��j�s�x�
�
� � �c�o�n�s�t� �d�a�t�a� �=� �{�
�
� � � � �l�e�n�g�t�h�:� �1�0�,�
�
� � � � �l�o�w�e�r�c�a�s�e�:� �f�a�l�s�e�,� �/�/� �t�r�u�e� �i�f� �y�o�u� �n�e�e�d� �l�o�w�e�r�c�a�s�e� �l�e�t�t�e�r�s� �i�n� �t�h�e� �u�n�i�q�u�e� �I�D�
�
� � � � �s�y�m�b�o�l�:� �f�a�l�s�e�,� �/�/� �t�r�u�e� �i�f� �y�o�u� �n�e�e�d� �s�y�m�b�o�l� �l�e�t�t�e�r�s� �i�n� �t�h�e� �u�n�i�q�u�e� �I�D�
�
� � �}�;�
�
�
�
� � �r�e�a�c�t�U�n�i�q�u�e�I�d�(�d�a�t�a�)�;�
�
� � �
��
�
�
�
�
� � �O�u�t�p�u�t�:� �A� �u�n�i�q�u�e� �I�D� �i�s� �g�e�n�e�r�a�t�e�d� �b�a�s�e�d� �o�n� �y�o�u�r� �c�u�s�t�o�m�i�z�a�t�i�o�n�/�r�e�q�u�i�r�e�m�e�n�t�.�
�
�
�
� � ��
��j�s�x�
�
� � �"�B�F�U�0�3�W�E�T�S�5�6�B�5�9�U�"�;�
�
� � �
��
�
�
�
�
� � �>� �[�!�N�O�T�E�]� � �
�
� � �>� �B�y� �d�e�f�a�u�l�t�,� �a�l�l� �t�y�p�e�s� �a�r�e� �t�r�u�e�.�
�
�
�
� � �-� �T�o� �g�e�n�e�r�a�t�e� �a�n� �I�D� �o�f� �t�h�e� �f�o�r�m�a�t� ��2�3�5�7�3�5�2�7�-�a�T�2�s�%�J�R�6�@�-�Y�W�D�B�S�C�Y�E�
�,� �y�o�u� �c�a�n� �u�s�e� �t�h�e� �f�o�l�l�o�w�i�n�g� �c�o�n�f�i�g�u�r�a�t�i�o�n�:�
�
�
�
� � � � ��
��j�s�x�
�
� � � � �c�o�n�s�t� �d�a�t�a� �=� �{�
�
� � � � � � �l�e�n�g�t�h�:� �[�8�,� �"�n�u�m�b�e�r�"�,� �9�,� �8�,� �"�u�p�p�e�r�c�a�s�e�"�]�,�
�
� � � � � � �s�e�p�a�r�a�t�e�r�:� �"�-�"�,�
�
� � � � �}�;�
�
�
�
� � � � �r�e�a�c�t�U�n�i�q�u�e�I�d�(�d�a�t�a�)�;�
�
� � � � �
��
�
�
�
�
� � � � �O�u�t�p�u�t�:� �A� �u�n�i�q�u�e� �I�D� �i�s� �g�e�n�e�r�a�t�e�d� �w�h�e�r�e� �t�h�e� �f�i�r�s�t� �8� �c�h�a�r�a�c�t�e�r�s� �a�r�e� �n�u�m�b�e�r�s�,� �t�h�e� �n�e�x�t� �9� �c�h�a�r�a�c�t�e�r�s� �c�a�n� �b�e� �a�n�y� �t�y�p�e�,� �a�n�d� �t�h�e� �l�a�s�t� �8� �c�h�a�r�a�c�t�e�r�s� �a�r�e� �i�n� �u�p�p�e�r�c�a�s�e�.� �T�h�e�y� �a�r�e� �s�e�p�a�r�a�t�e�d� �u�s�i�n�g� �a� �s�e�p�a�r�a�t�o�r�.�
�
�
�
� � � � ��
��j�s�x�
�
� � � � �"�7�2�3�2�4�1�1�8�-�7�1�*�x�W�4�f�H�C�-�A�N�T�I�T�O�W�I�"�;�
�
� � � � �
��
�
�
�