Using 3rd party libraries
A 3rd party library may have useful functionality that isn't offered by the Views component library.
Views are React apps and allow 3rd party libraries to be installed.
In the following example, we install the
react-confetti package by running:
bashCopied1npm install react-confetti
bashCopied1yarn add react-confetti
Once the component is installed, it can be imported and used in the view.
tsxCopied1import { Checkbox, Stack, Title, useComponentState } from "@airplane/views";2import Confetti from "react-confetti";34const ConfettiParty = () => {5const shouldRainConfetti = useComponentState();67return (8<Stack style={{ padding: 200 }}>9<Stack align="center">10<Title>Airplane views party</Title>11<Checkbox label="Celebrate" id={shouldRainConfetti.id} />12</Stack>13{/* 🌟 Enable the custom <Confetti> component when the checkbox is checked. */}14{shouldRainConfetti.checked && <Confetti />}15</Stack>16);17};1819export default ConfettiParty;
Up next
Up next
Learn how to style your components to give your view a consistent and high quality look and feel.