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
///.... your other imports | |
import I18n from 'redux-i18n'; | |
import { translations } from '__src__/config/locales/index'; | |
ReactDOM.render( | |
<Provider store={store}> | |
<I18n translations={translations} initialLang="en" fallbackLang="en"> | |
<App /> | |
</I18n> |
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
import React, { Component } from 'react'; | |
import PropTypes from 'prop-types'; | |
/** | |
* This is an react component that echo an hello world | |
*/ | |
class SomeReactComponent extends Component { | |
render() { | |
return <div> {this.props.title} </div>; | |
} |
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
{ | |
"scripts": { | |
"doc": "./docs.sh" | |
} | |
} |
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
cd "src" | |
# find . -type d -print0 | xargs -0 -L1 sh -c 'cd "$0" && pwd && react-doc-generator $0 -o ./$0/README.md' | |
find . -type d -print0 | xargs -0 -L1 sh -c 'cd "$0" && pwd && react-doc-generator . -o ./README.md' |
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 save = (id) => { | |
//your save code here | |
return { | |
goToUserProfile: () => window.location.replace(`myurl.example/profile`) | |
} | |
}; |
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 save = (id, redirectAfterSave) => { | |
//your save code here | |
if(redirectAfterSave) { | |
window.location.replace(`myurl.example/user/${id}`) | |
} | |
return null; | |
} |
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 save = (id) => { | |
//your save code here | |
return { | |
goToUserProfile: () => window.location.replace(`myurl.example/profile/${id}`) | |
} | |
}; |
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 save = (id) => { | |
//your save code here | |
return { | |
goToUserProfile: (name) => | |
confirm(`Hi ${name}, you'd like to be redirected to your page`) | |
? window.location.replace(`https://myurl.example/profile/${id}`) | |
: false | |
} | |
}; |
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
function showNameAndAge(name, age){ | |
return `Hello ${name}, you are ${age} years old`; | |
} | |
showNameAndAge('Ricardo', 32); //right | |
showNameAndAge(32, 'Ricardo'); //wrong |
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
function showNameAndAge({name, age}){ | |
return `Hello ${name}, you are ${age} years old`; | |
} | |
showNameAndAge({name: 'Ricardo', age: 32}); //right | |
showNameAndAge({age: 32, name: 'Ricardo'}); //also right! |