Skip to content

Instantly share code, notes, and snippets.

View bmind12's full-sized avatar
🧘‍♂️
Observing

Sergej R. bmind12

🧘‍♂️
Observing
  • Prague
View GitHub Profile
@bmind12
bmind12 / extend-ac-in-mapDispatchToProps.js
Created April 5, 2018 05:35
Extension of an Action Creator within mapDispatchToProps function
export default connect(null, (dispatch, ownProps) => ({
addComment: (comment) => dispatch(addComment(comment, ownProps.articleId))
}))(CommentForm)
@bmind12
bmind12 / action-with-flag.js
Created April 5, 2018 05:26
Action creator with flag
export function addComment(comment, articleId) {
return {
type: ADD_COMMENT,
payload: { comment, articleId },
generateId: true
}
}
@bmind12
bmind12 / react-ref-new
Last active April 1, 2018 11:23
React refs - new way of naming
render() {
return (
<div ref={this.setContainerRef}>
Hello world!
</div>
)
}
setContainerRef = ref => {
this.container = ref;
@bmind12
bmind12 / react-ref-old
Last active April 1, 2018 11:16
React refs - old way of naming
render() {
return (
<div ref='string'>
Hello world!
</div>
)
}