I´m trying to understand why with this code:
class App extends React.Component{
constructor(props) {
super(props);
this.state = {
mark: defaultText
}
}
render(){
return (<div className="testing">
<h1>Welcome to my React Markdown Previewer!
</h1>
<div className="dividir">
<Editor />
<Previewer value={this.state.mark} />
</div>
</div>
)
}
}
class Editor extends React.Component {
constructor(props){
super(props);
}
render() {
return (<textarea id="editor" placeholder="type something..." onChange={this.handleChange}/>);
}
}
class Previewer extends React.Component {
render() {
return (
<div id="preview">OUTPUT</div>
)
}
}
const defaultText = `# Welcome to my React Markdown Previewer!
## This is a sub-heading... etc `
The editor´s value doesn´t get updated and it isn´t shown: `
# Welcome to my React Markdown Previewer!
## This is a sub-heading...
in the previewer. After setting the value of Previewer with the state of App (which is the defaultText variable) it doesn´t change anything still.
SO i just tried to do…
<Previewer value="testing teesting" />
And neither it changes so I really don´t understand what it needs to be done. To be honest I am not surprised since I don´t really know how React could know that when I say value im referring to textarea value
This is my codepen where I´m doing it: https://codepen.io/Assblack/pen/YbWyWw