Last active
September 12, 2021 10:17
-
-
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
This file contains 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
// 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