function hello(name) {
return `Hello ${name}!`
}
> hello('Amelia')
"Hello Amelia!"
var name = 'Amelia'
function hello() {
return `Hello ${name}!`
}
> hello()
"Hello Amelia!"
> name = 'Diane'
> hello()
"Hello Diane!"
var person = {}
function hello(name) {
person.name = name
return `Hello ${name}!`
}
> person
{}
> hello('Amelia')
"Hello Amelia!"
> person
{ name: "Amelia" }
export class Hello extends React.Component {
constructor(props) {
super(props)
state = {}
}
render() {
return (
<p>Hello { this.props.name }!</p>
)
}
}
const element = <Hello name="Amelia" />
ReactDOM.render(
element,
document.getElementById('root')
)
function Hello(props) {
return (
<p>Hello { props.name }!</p>
)
}
function Hello(props) {
return (<p>Hello { props.name }!</p>)
}
describe('Hello', () => {
it('should say hi', () => {
const wrapper = shallow(<Hello name="Amelia" />)
expect(wrapper.html())
.toEqual('<p>Hello Amelia!</p>')
})
})
function Hello(props) {
return (
<p>{ props.name }</p>
)
}
function App() {
return (
<div>
<Hello name="Amelia" />
<Hello name="Diane" />
</div>
)
}