Skip to content

Instantly share code, notes, and snippets.

@ProspektsMarch22
Created October 2, 2022 19:50
Show Gist options
  • Save ProspektsMarch22/2c404124f794e51aad88e7b63953e43e to your computer and use it in GitHub Desktop.
Save ProspektsMarch22/2c404124f794e51aad88e7b63953e43e to your computer and use it in GitHub Desktop.
React props used for changing UI
import React from 'react';
import ReactDOM from 'react-dom';
import { Welcome } from './Welcome';
class Home extends React.Component {
render() {
return <Welcome name='Ludwig van Beethoven' />;
}
}
ReactDOM.render(
<Home />,
document.getElementById('app')
);
import React from 'react';
export class Welcome extends React.Component {
render() {
if (this.props.name === 'Wolfgang Amadeus Mozart') {
return (
<h2>
hello sir it is truly great to meet you here on the web
</h2>
);
} else {
return (
<h2>
WELCOME "2" MY WEB SITE BABYYY!!!!!
</h2>
);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment