Straight from the react docs [1]:
if (isLoggedIn) {
return <UserGreeting />;
}
How is that different? if (isLoggedIn) {
return <UserGreeting />;
}
How is that different?This is fine:
<?php
if (condition) {
?>
<div>whatever</div>
<?php
{
?>
this not: if (isLoggedIn) {
return <UserGreeting />;
{ function
ThemedButton(props) {
return (
<ThemeContext.Consumer>
{theme => (
<button
{...props}
style=.
{{backgroundColor:
theme.background}}
/>
)}
</ThemeContext.Consumer>
);
}
I've been writing JavaScript for 15 years and this looks like gibberish to me. There's at least 3 context switches between JavaScript, JSX and CSS. We're abandoning separation of concerns and creating a monstrosity of programming by punctuation.