Friday, October 10, 2025
HomeLanguagesHow to concatenate unicode and variable in ReactJS ?

How to concatenate unicode and variable in ReactJS ?

Unicode: Unicode is an encoding standard for all characters in the universe. Every language code and symbol in this world is assigned by Unicode. There is no encoding standard that supports all languages, By using Unicode standard, we can retrieve and combine data with all language combinations.

Example: 

U+2192

In the above example, a right-facing arrow is represented in Unicode by U+2192.

How to create React Application:

  • Step 1: Create a React application using the following command.

     npx create-react-app neveropen
  • Step 2: After creating your project folder i.e. neveropen, move to it using the following command.

    cd neveropen
  • Project Structure:

    Folder structure

    How to concatenate Unicode and variable in ReactJS: To concatenate we first convert Unicode into its numerical value and for that, we will use parseInt.

parseInt(Unicode,base)

Now, this numerical value needs to be converted into its character and for that, we can use

String.fromCodePoint(numericalValue).

Example: Make the following changes to your App.js file

App.js




import React from 'react'
    const App = ({ unicode }) => {
  
    return(
  
       <h1>
           This is a Right arrow
           {String.fromCodePoint(parseInt(unicode,16))}
       </h1>
   )}
export default App;


Now import this App.js file in your index.js file(by default it is already being imported) and pass the value of Unicode in the App component.

index.js




import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
  
    ReactDOM.render(
    <React.StrictMode>
       <App unicode='2192'/>
    </React.StrictMode>,
  
   document.getElementById('root')
  
    );


Now run the local server using the following command within the react-app directory  

npm start

Output:

Whether you’re preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape, neveropen Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we’ve already empowered, and we’re here to do the same for you. Don’t miss out – check it out now!
RELATED ARTICLES

Most Popular

Dominic
32348 POSTS0 COMMENTS
Milvus
87 POSTS0 COMMENTS
Nango Kala
6715 POSTS0 COMMENTS
Nicole Veronica
11878 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11941 POSTS0 COMMENTS
Shaida Kate Naidoo
6837 POSTS0 COMMENTS
Ted Musemwa
7097 POSTS0 COMMENTS
Thapelo Manthata
6791 POSTS0 COMMENTS
Umr Jansen
6791 POSTS0 COMMENTS