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 from 'react'; | |
const renderItemsText = items => { | |
if (items.length > 0) { | |
return <p>Print sth since we have some items in our list</p>; | |
} | |
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
import React from 'react'; | |
export default ({ items }) => ( | |
<div> | |
{items.length > 0 ? <p>Print sth since we have some items in our list</p> : null} | |
</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
import React from 'react'; | |
export default ({ items }) => ( | |
<div> | |
{items.length > 0 && <p>Print sth since we have some items in our list</p>} | |
</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
import React from 'react'; | |
export default ({ items }) => ( | |
<div> | |
{!!items.length && <p>Print sth since we have some items in our list</p>} | |
</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
import React from 'react'; | |
export default ({ items }) => ( | |
<div> | |
{Boolean(items.length) && <p>Print sth since we have some items in our list</p>} | |
</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
import React from 'react'; | |
export default ({ items }) => ( | |
<div> | |
{items.length && <p>Print sth since we have some items in our list</p>} | |
</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
import React from 'react'; | |
export default ({ isTruthy }) => ( | |
<div> | |
{isTruthy && <p>Print sth since prop isTruthy is really truthy</p>} | |
</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
Show hidden characters
{ | |
"presets": [ | |
[ | |
"env", | |
{ | |
"targets": { | |
"browsers": [ | |
"last 2 versions", | |
"ie > 9" | |
] |
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 from 'react'; | |
import { shallow } from 'enzyme'; | |
import Options from './'; | |
describe('test Options component', () => { | |
it('instance method handleAdd should be triggered when add button gets clicked', () => { | |
const enzymeWrapper = shallow(<Options />); | |
enzymeWrapper.instance().handleAdd = jest.fn(); |
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'; | |
export default class Options extends Component { | |
handleAdd = () => { | |
console.log('add'); | |
}; | |
handleEdit = () => { | |
console.log('edit'); | |
}; |