Getting started with react on codepen

How to use work with react in codepen
class Html extends React.Component

Honestly, I suggest using something other than CodePen, such as or [edit in 2021: I highly suggest codesandbox]. If you really want to use CodePen, you need to add react as a JS dependency. Click on “Settings” at the top of your pen, then “Javascript” in the pop-up. Under “javascript preprocessor”, select Babel, and under “add external scripts/pens”, type “react”. Select both react and react-dom. You should now be ready to use React.

On jsbin, you just need to add the relevant <script> tags, with none of this hoop-jumping.


I did that but it is still not working

So please give us a link to your code in codepen, jsbin or codesandbox
import this and it will work

I went to this Pen and did what they did. They added “//” under the javascript settings like this…

I’ve created react project using create-react-app and want to run in codepen but it’s not working even with above solution.

How did you create your project ?