Create and embed repl environment in React webpage

I am trying to create a site for my coding students to do practice problems. The problems would be for basic javascript (primary use), html and css, and React components. To do this I believe I would need a REPL embedded in my React components (not sure if my terminology is correct here; by REPL I mean an environment to write code, execute it, and see any output in a console). I also need to be able to run tests on their code.

I know repl.it (the website) has an API for this, but I would like to learn how to create it from scratch. Furthermore, I can’t find any resources on how to implement something like this in a React app specifically.

All I’ve been able to find so far is vague references to Linux containers and some mentions of Docker. I have no experience with either of these. If someone could point me to a resource to help me learn how to set this up and integrate it in my React app I would be very appreciative.

A good example of what I want would be the REPL in codewars. You can write code, then run tests and get specific feedback on that code.