1.I am working on React.js. I worte simple code in App.js and All data presented
ID: 3719225 • Letter: 1
Question
1.I am working on React.js. I worte simple code in App.js and All data presented must be written in a JSON blob in index.js. but when I changed the code from index.js, it wont change on App.js. It must be some wrong on Index.js and I couldn't figure out.
This is my code
App.js
import React, { Component } from 'react';
<div id ="root"></div>
class App extends Component {
render() {
return (
<div>
<Description />
<DescriptionOne />
<DescriptionFour />
</div>
);
}
}
class Description extends Component{
render(){
return (
<h1>John Legend</h1>
);
}
}
class DescriptionFour extends Component{
render(){
return (
<div>
<li> Learning New Things </li>
<li> Watching Soccer </li>
</div>
);
}
}
export default App;
--------------------------------------------------------------------------
This is Index.js
index.js
import React from 'react';
import ReactDOM from 'react-dom';
import './index.css';
import App from './App';
import registerServiceWorker from './registerServiceWorker';
var data = {
Descript: 'Kany West',
DescriptionFour: ["Playing Football",
"Reading books"]
}
ReactDOM.render(<App profileData={data}/>, document.getElementById('root'));
registerServiceWorker();
Explanation / Answer
What code you are changing in index.js?
And what is the error that you are getting?
If you can clarify the above doubts, I can give the more precise answer for you.
If you are trying to pass data from index js to app js. You can access the data from this.props.profileData in app.js
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.