@swarmakit/react
v0.0.22
Published
<div style="text-align: center;">
Downloads
9
Readme
React + TypeScript + Vite
This template provides a minimal setup to get React working in Vite with HMR and some ESLint rules.
Currently, two official plugins are available:
- @vitejs/plugin-react uses Babel for Fast Refresh
- @vitejs/plugin-react-swc uses SWC for Fast Refresh
Expanding the ESLint configuration
If you are developing a production application, we recommend updating the configuration to enable type aware lint rules:
- Configure the top-level
parserOptionsproperty like this:
export default tseslint.config({
languageOptions: {
// other options...
parserOptions: {
project: ['./tsconfig.node.json', './tsconfig.app.json'],
tsconfigRootDir: import.meta.dirname,
},
},
})- Replace
tseslint.configs.recommendedtotseslint.configs.recommendedTypeCheckedortseslint.configs.strictTypeChecked - Optionally add
...tseslint.configs.stylisticTypeChecked - Install eslint-plugin-react and update the config:
// eslint.config.js
import react from 'eslint-plugin-react'
export default tseslint.config({
// Set the react version
settings: { react: { version: '18.3' } },
plugins: {
// Add the react plugin
react,
},
rules: {
// other rules...
// Enable its recommended rules
...react.configs.recommended.rules,
...react.configs['jsx-runtime'].rules,
},
})Installation
Install the @swarmakit/react library through npm:
npm install @swarmakit/reactPrerequisites
Node.js and npm should be installed. You can verify installation with:
node -v
npm -v Setting Up a Vite + React Project (If you haven't already)
To initialize a Vite project for React with TypeScript, run:
npm create vite@latest my-react-app -- --template react-tsreplacing my-react-app with your project name.
Then, navigate to your project folder:
cd my-react-appImporting Components and Basic Usage in React
Import Components: To use a component in your application, import it from the
@swarmakit/reactlibrary as shown below:import { ComponentName } from '@swarmakit/react'Example Usage in JSX: Use the imported component within your React component:
function App() { return ( <div> <ComponentName prop1='value' /> </div> ) }
Available Components: Swarmakit React includes a vast library of components. See the full list in the stories folder on GitHub.
