Skip to content

Commit

Permalink
fix: use !! syntax
Browse files Browse the repository at this point in the history
  • Loading branch information
lottamus committed Jan 28, 2019
1 parent b33ec37 commit c12ef9a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions src/Checkbox.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import { Box, Flex, IBox, useTheme } from './';
export const Checkbox: FunctionComponent<ICheckbox> = props => {
const { id, disabled: isDisabled, onChange, ...rest } = props;

const [checked, setValue] = useState<boolean>(props.checked || false);
const isChecked = props.hasOwnProperty('checked') ? props.checked || false : checked;
const [checked, setValue] = useState<boolean>(!!props.checked);
const isChecked = props.hasOwnProperty('checked') ? !!props.checked : checked;

const css = checkboxStyles({ isDisabled, isChecked });

Expand Down
4 changes: 2 additions & 2 deletions src/Toggle.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,8 @@ const circleStyles = ({ isChecked }: IToggleCircleProps) => {
export const Toggle: FunctionComponent<IToggle> = props => {
const { id, disabled: isDisabled, onChange, ...rest } = props;

const [checked, setValue] = useState<boolean>(props.checked || false);
const isChecked = props.hasOwnProperty('checked') ? props.checked || false : checked;
const [checked, setValue] = useState<boolean>(!!props.checked);
const isChecked = props.hasOwnProperty('checked') ? !!props.checked : checked;

const css = toggleStyles({ isDisabled, isChecked });

Expand Down

0 comments on commit c12ef9a

Please sign in to comment.