I have a code that repeats on every page.
How can I solve this problem by reusing the script.
export default class App extends Component<{}> {
onMenuItemSelected = item =>{
if(item == "inicial")
{
Actions.inicial();
}
else if(item == "agendamento")
{
Actions.agendamento();
}
}
render() {
const menu = <Menu onItemSelected={this.onMenuItemSelected} />;
return (
...
);
}
}
In case I would like to reuse the code of onMenuItemSelected
.