Aloysious' Codefellows Reading Notes
<== Previous Lesson Next Lesson ==>
<== Home 🏠
Elements are what components are “made of”. . .
The only method you must define in a
React.Component
subclass is calledrender()
. . .
The difference between state and props { Component State
} - React Docs
props
get passed to the c omponent (similar to function parameters)
whereas state
is managed within the component (similar to variables declared within a function).
Things to consider about data in regards to state
:
props
? If so, it probably isn’t state
.state
.state
or props
in your component
? If so, it isn’t state.What can I remember about rendering Hello World
App.js - default parent, Import React, App(css) and Header.js to the top of this page…then export.
import React from 'react';
import './App.css';
import Header from './Header.js';
class App extends React.Component {
render(){
return(
<div>
<Header />
</div>
)
}
}
export default App;
Header.js Import React, Header(css) to the top of this page, return
: <h1></h1>
…then export.
import React from 'react';
import './Header.css';
class Header extends React.Component {
render() {
return(<h1>Aloysious remembers bits and pieces</h1>);
}
}
export default Header;
<== Home 🏠