This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// in the function body | |
let description; | |
if (product.description) { | |
description = <p>{`Description: ${product.description}`}</p> | |
} | |
// Bellow the h3 closing tag | |
{description} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{product.description ? <p>{`Description: ${product.description}`}</p> : null} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{product.description && <p>{`Description: ${product.description}`}</p>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{products.map(product => { | |
return ( | |
<div> | |
<h3> | |
<a title={`${product.name} details`}> | |
{ product.name } | |
</a> | |
</h3> | |
</div> | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular | |
<!-- <Tag *if="name"></Tag> --> | |
// React | |
render() { | |
return ( | |
<p> | |
{/* This is a comment, one line */} | |
{// This is a block |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular HTML | |
<div (click)="fn()" >Click me!</div> | |
// Angular Component | |
@Componet( ... ) | |
export class MyComponent { | |
fn() { | |
console.log('Clicked') | |
}; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Angular | |
<h1>{{name}}</h1>; | |
// React | |
<h1>{name}</h1>; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Functions Mode looks like: | |
function MyHair(props) { | |
return <h1>My hair is, {props.color}</h1>; | |
} | |
// Class Mode looks like: | |
class MyHair extends React.Component { | |
render() { | |
return <h1>My hair is, {props.color}</h1>; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
React.createElement( | |
MyHair, | |
{color: 'blue'}, | |
'My Head' | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<MyHair color="blue"> | |
My Head | |
</MyHair> |