I have a React app, I need to download the tldraw package, and import it locally
- User
I have a React app, I need to download the tldraw package, and import it locally
Assistant
To download and import the
tldrawpackage into your React app, follow these steps:-
Open your project in your favorite code editor (e.g., Visual Studio Code, Atom, Sublime Text).
-
Open a terminal or command prompt and navigate to the root directory of your React project.
-
Run the following command to install the
tldrawpackage:
bashnpm install tldrawor if you're using Yarn:
bashyarn add tldraw- Once the package is installed, you can import it into your React component. Since
tldrawis a collection of components and hooks, import only the ones you need. For example, if you want to use theTLDSproutcomponent, do the following:
jsximport { TLDSprout } from 'tldraw';- Use the imported component in your React component:
jsx-