Skip to content

Instantly share code, notes, and snippets.

@eaccmk
Last active September 12, 2021 10:17
Show Gist options
  • Save eaccmk/6475ffa784e291d62ff63ba03adb08e0 to your computer and use it in GitHub Desktop.
Save eaccmk/6475ffa784e291d62ff63ba03adb08e0 to your computer and use it in GitHub Desktop.
Fitbit app companion (mobile) setting to implement advance coding such as methods and variables inside index.jsx
// author : https://github.com/eaccmk
// created : sep-2021
//Advanced jsx in fitbit
const user = {
firstName: "Fitbit",
lastName: "Buddy",
};
function getFullName(user) {
return user.firstName + " " + user.lastName;
}
function getGreeting(user) {
if (user) {
return "Hello," + getFullName(user);
} else {
return "Hi mate, what's up !";
}
}
function mySettings(props) {
return (
<Page>
<Text>First name : {user.firstName}</Text>
<Text>Last name : {user.lastName}</Text>
<Text>M(x). {getFullName(user)} (full name)</Text>
<Text>Using fun() : {getGreeting(user)}</Text>
<Text>Using fun() within fun() : {getGreeting(user)}</Text>
</Page>
);
}
registerSettingsPage(mySettings);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment