baha
July 28, 2020, 1:25pm
1
Hello guys, could you take a look at my markdown react project and tell me what’s wrong? it’s not working and it’s giving me an error that I don’t understand:
It’s working on my local machine but it didn’t work when I moved it to codepen.
P.S: I’m using materia-ui as part of the project instead of bootstarp.
Take a look at this question and the answer that has 8 points
javascript, reactjs
/Jakob
baha
July 28, 2020, 1:47pm
3
I think this implies if I didn’t use Bable as a preprocessor in JS.
I tried to do what was suggested on your Codepen using
const { Component } = React;
const { render } = ReactDOM;
const {Paper, Typography} = 'material-ui/core';
const { marked} = 'marked';
and it made the
Uncaught ReferenceError: require is not defined
go away. It seems there is a problem with marked but I have not dived into that
/Jakob
baha
July 28, 2020, 1:54pm
5
Thanks for your help, I’ll try it again.
baha
July 28, 2020, 1:55pm
6
The error goes away from the editor but you can still see it in the console if you open it, as I can see.
baha
July 29, 2020, 10:57am
7
Turned out I should write
const {Typography} = MaterialUI;
const {Paper} = MaterialUI;
and it worked (after I got material-ui from a cdn)