DEV Community

Bret
Bret

Posted on

How do you connect c++ in a react project?

How do you connect a C++ file to React?

Top comments (7)

Collapse
 
hamiecod profile image
Hargunbeer Singh

Use C++ addons for node.js

P.S: You would get a better response in Stack Exchange or StackOverFlow :)

Collapse
 
yobretyo profile image
Bret

Thank you, I actually can’t stand Stack Overflow.... you mess up spelling, and they attack or even just a topic.... they get mad if you ask a NEW variation of a Question, that hasn’t been asked... and they get mad

Collapse
 
hamiecod profile image
Hargunbeer Singh

That's a shocking reality of StackOverFlow, which needs to change as people will only be comfortable asking questions if the community is chill(informal).

Collapse
 
tiagomelojuca profile image
Tiago Melo Jucá

You have some options here:
1) Use the NodeJS nAPI to build a native module
2) Use a C++ application as backend for your React SPA
3) Use child_process (or something like ShellJS) to handle I/O of your C++ binary
4) Take a look at Web Assembly

Collapse
 
ats1999 profile image
Rahul kumar

Make a browser which can also parse c++.

Good luck

Collapse
 
mohdahmad1 profile image
Mohd Ahmad

through wasm

Collapse
 
shajidhasan profile image
Shajid Hasan

Run C++ in your backend/server. Communicate with it from your frontend with http requests.