This file contains hidden or 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
class Todo extends React.Component { | |
handleClick = e => { | |
this.props.onClick(this.props.todo.id); | |
}; | |
render() { | |
return ( | |
<li className="todo" onClick={this.handleClick}> | |
{this.props.todo} | |
</li> |
This file contains hidden or 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
render() { | |
return ( | |
<ul> | |
{this.props.todos.map(todo => ( | |
<Todo | |
todo={todo} | |
onClick={this.props.handleClick.bind(this)} | |
/> | |
))} | |
</ul> |
This file contains hidden or 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
constructor(props) { | |
super(props); | |
this.handleClick = this.handleClick.bind(this); | |
} |
This file contains hidden or 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
handleClick = todoId => { | |
this.setState({ | |
[todoId]: { clicked: true } | |
}); | |
}; |
This file contains hidden or 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
export default class extends React.PureComponent { | |
render() { | |
return ( | |
<TodoList | |
options={{ | |
wrap: false, | |
maximizeOnFoucs: true | |
}} | |
/> | |
); |
This file contains hidden or 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
const TODO_LIST_OPTIONS = { | |
wrap: false, | |
maximizeOnFoucs: true | |
}; | |
export default class extends React.PureComponent { | |
render() { | |
return <TodoList options={TODO_LIST_OPTIONS} />; | |
} | |
} |
This file contains hidden or 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
// You have this 4 components | |
const elements = [ | |
{ type: "div", key: 0, textContent: "Container #0" }, | |
{ type: "div", key: 1, textContent: "Container #1" }, | |
{ type: "div", key: 2, textContent: "Container #2" }, | |
{ type: "div", key: 3, textContent: "Container #3" } | |
]; | |
// Delete Container #1 | |
const elements = [ |
This file contains hidden or 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
const TodoFactory = ({ todo, onClick }) => ( | |
<li className="todo" onClick={onClick}> | |
{todo.title} | |
</li> | |
); | |
export default ({ todos }) => ( | |
<ul>{todos.map(todo => TodoFactory({ todo, onClick: console.log }))}</ul> | |
); |
This file contains hidden or 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
class DTO: | |
def __init__(self, id_): | |
self._id = id_ | |
@property | |
def id(self): | |
return self._id | |
class UserDTO(DTO): |
This file contains hidden or 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
const React = require("react"); | |
const config = require("../config"); | |
const createGoogleOptimizeSnippet = experimentsIds => ` | |
gtag('config', '${config.GTM_ID}', {'optimize_id': '${ | |
config.GOOGLE_OPTIMIZE_ID | |
}'}); | |
${experimentsIds.map(expId => `gtag('set', {'expId': '${expId}'});`)} | |
window.onload = function(){dataLayer.push({'event': 'optimize.activate'});}; | |
`; |