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
// utils/get_prefix.js | |
// Changed the return value from 'mega' to 'hyper' | |
export const getPrefix = () => 'hyper'; | |
// utils/prefix_word.js | |
export const prefixWord = (prefixGetter, wordToPrefix) => prefixGetter() + wordToPrefix; | |
// spec/utils/get_prefix_spec.js | |
import getPrefix from '../../utils/get_prefix'; |
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
// utils/get_prefix.js | |
// Changed the return value type from string to object | |
export const getPrefix = () => ({ en: 'mega', fr: 'méga' }); | |
// utils/prefix_word.js | |
export const prefixWord = (prefixGetter, wordToPrefix) => prefixGetter() + wordToPrefix; | |
// spec/utils/get_prefix.js | |
import getPrefix from '../../utils/get_prefix'; |
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
// containers/form_container.js | |
import Form from '../components/form_component'; | |
export const mapStateToProps = state => ({ username: state.username }); | |
export default connect(mapStateToProps)(Form); | |
// components/form_component.js | |
import PropTypes from 'prop-types'; | |
import React from 'react'; |
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
// containers/form_container.js | |
import Form from '../components/form_component'; | |
// The container passes a 'username' prop (type: string) to Form | |
export const mapStateToProps = state => ({ username: state.username }); | |
export connect(mapStateToProps)(Form); | |
// components/form_component.js | |
import PropTypes from 'prop-types'; | |
import React from 'react'; |
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
// utils/get_prefix.js | |
export const getPrefix = (lang) => { | |
if (lang === 'fr') return 'méga'; | |
return 'mega'; | |
}; | |
// utils/prefix_word.js | |
export const prefixWord = (prefixGetter, wordToPrefix) => prefixGetter() + wordToPrefix; | |
// spec/fixtures/prefix_fixtures.js |
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
// containers/form_container.js | |
import Form from '../components/form_component'; | |
export const mapStateToProps = state => ({ username: state.username }); | |
export default connect(mapStateToProps)(Form); | |
// components/form_component.js | |
import PropTypes from 'prop-types'; | |
import React from 'react'; | |
const Form = class extends React.Component { |
OlderNewer