es6: How to define functions inside a const?
What you called 'a const' is in fact an arrow function. In JS, you can add any nested functions as you want:
const Category = (props) => {
const ds = ListView.DataSource({rowHasChanged : (r1, r2) => r1 !== r2});
// how to declare function here?
// You can declare another arrow function if you want:
const foo = () => console.log('arrow');
// Or a standard function
function bar() { console.log('standard'); }
// Even a function returning a function :-)
function baz() { return function() {...} }
const renderCustomComponent = () => <div>____</div>
return (
<View>
<ListView
dataSource={ds}
renderRow={(rowData) => <Text>{rowData}</Text>}
renderSeparator={ renderCustomComponent } {/* Here goes your reference */}
/>
</View>
);
}