โก Ionic React Scratchpad
๐ Table of contents
๐ General info
App created using Ionic CLI v5
๐ท Screenshots
๐ถ Technologies
๐พ Setup
Load dependencies using npm i
,
To start the server on localhost://8100 type: 'ionic serve'
๐ป Code Examples
function to calculate BMI from user inputs for height & weight
const calculateBMI = ( ) => {
const enteredWeight = weightInputRef . current ! . value ;
const enteredHeight = heightInputRef . current ! . value ;
if (
! enteredHeight ||
! enteredWeight ||
+ enteredHeight <= 0 ||
+ enteredWeight <= 0
) {
setError ( "Please enter a valid number" ) ;
return ;
}
const weightConversionFactor = calcUnits === 'ftlbs' ? 2.20 : 1 ;
const heightConversionFactor = calcUnits === 'ftlbs' ? 3.28 : 1 ;
const weight = + enteredWeight / weightConversionFactor ;
const height = + enteredHeight / heightConversionFactor ;
setCalculatedBmi ( weight / ( height * height ) ) ;
} ;
๐ Features
ion cards are responsive so app looks good on PC or mobile screen
๐ Status & To-do list
Status: working. Updated april 2021. Minor error: result card does not disappear when reset button is pressed
To-do: Fix reset and add functionality
๐ Inspiration
๐ License
This project is licensed under the terms of the MIT license.
โ๏ธ Contact