From the title, your first question is probably why?
Well, let me tell you why...
I'm building an app called
mulVid. It's a Collaborative Video Production and Asset Managment Suite but more importantly it's completely web-based. Anyone who knows anything about video internals will tell you that
FFmpeg is the gold standard for just about every task you could carry out on a video and while mulVid is not an
FFmpeg wrapper per se, we do rely heavy on the internal
FFmpeg libs.
Ok now you're asking, "Wtf does this have to do with porting the React Docs" to which I would respond, "Patience Padawan".
On a more serious note though, the connection is that FFmpeg is written in C and
mulVid is web-based so I had two options:
- Build mulVid w/ React and cross-compile FFmpeg to become callable from JS/TS
- Build mulVid in C/C++ and cross-compile the entire app to WebAssembly (s/o to Emscripten)
Decisions, decisions...
On the one hand, I was already familiar with
React from previous projects but I was also partial to option 2 because I had just done a deep dive on
Dear Imgui for a totally different project and I knew it would be a great fit for
mulVid.
Seeing as I had never done a deep-dive on
React and the docs were in JS, I realized I could kill two birds with one stone. By porting from JS to TS, I could learn about every feature
React had to offer and also create a codebase of TS examples for anyone who needed it.
All in all, the process took the better part of the week and while challenging at times, it was a fun experience. I did still end up picking option 2 but I felt a lot more confident in my decision because I had a list of technical reasons why it was the better option rather than just going off of vibes. Also, fwiw my vibes were still directionally correct :)).
You can find the code
here.