import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
//import registerServiceWorker from './registerServiceWorker';
ReactDOM.render(
<App txt = "Hello FreeCodeCamp"/>,
document.getElementById('root'));
and add here - App.js
import React from 'react';
//const App = () => <h1> Hii </h1>
class App extends React.Component {
render(){
let txt = this.props.txt;
return <div>
<h1>{txt}</h1> <b> Bold </b>
</div>
//return React.createElement('h1',null, 'hello eggheds')
}
}
export default App
Also this is not working
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(
<App txt="this is the prop text" />
document.getElementById('root');
);
then add here -
import React from 'react';
class App extends React.Component {
render(){
return <h1>{this.props.txt}</h1>
}
}
export default App
Its not working and not showing any updated values , can any one please point to a latest version where i can learn reactjs , native,m redux … Thanks
Not sure on that one… Looks interesting though. Currently I am just at the start of working through the Udacity Nanodegree and this covers React however I am not sure how much detail it goes into so I will be checking this thread also.
I also have purchased Colt Steeles “Advanced Web Dev Bootcamp”. This covers React as well as a range of other topics that that could be worth a look? Not actually started the course however.
Hello @JABedford , thank you so much for your time, i have gone through the Javascript and dom and other stuff on udemy, eggehad and frontendmasters, i need to be ready with react native by mid of next month, so i need a course that is not too shallow but also not so advanced that it will take months …
I need to be in a position to contribute to a project in 45 days time, hence i am a bit confused as to what course to choose …
There doesn’t seem to be anything wrong with your code (bar some spacing in the first example txt = " should be txt=. In what way isn’t it working? That’s how you write React code, it’s not out of date
import React from 'react';
import ReactDOM from 'react-dom';
import App from './App';
ReactDOM.render(<App txt="this is the prop text" />,document.getElementById('root')
);
Buy i always get this error -
TypeError: __WEBPACK_IMPORTED_MODULE_0_react___default.a.PropTypes is undefined
This is same as they say, i tried for one hour not working , kindly guide …Thanks
Ah, you are right in terms of out of date (slightly), it used to be included in React but they moved to a separate package. You can either
just not do any typechecking and ignore those bits.
Or you install prop-types, then you can import PropTypes from 'prop-types'; everything else will be the same
Prop types aren’t necessary, they’re just a way of type checking everything, they’re a useful thing but just ignoring those bits and not including prop types code should be totally fine
I can’t personally speak to the quality of these courses as I haven’t done either of them yet, but they’re going to be the best deals by far because they’re on Udemy, which has regular $10 sales (and once you buy a course on Udemy, you basically get free lifetime updates). And the instructors for the respective courses update them regularly, so they’ll never be too out-of-date. Why bother paying for a Wes Bos course, or a Tyler McGinnis course, when you can get a Udemy course for $10 flat and never pay another dime? And if the Udemy reviews are anything to go by, they both seem to be pretty great courses too.
@DanCouper - thank you so much , for some one learning first time i did not know this thing, i guess even paid courses are not so good these days , they just skip so many things …