@starasia/admin
v1.0.6
Published
Core Admin FE for starasia UI
Keywords
Readme
@starasia/admin
Core Admin FE for starasia UI
Installation
npm install @starasia/admin react react-dom react-router-dom
# or
yarn add @starasia/admin react react-dom react-router-dom
# or
pnpm add @starasia/admin react react-dom react-router-domPeer Dependencies
This package requires the following peer dependencies:
react>= 18.2.0react-dom>= 18.2.0react-router-dom^6.23.0
Usage
IMPORTANT: You must wrap your application with BrowserRouter (or another router provider) from react-router-dom before using any components from @starasia/admin.
Basic Setup
import { BrowserRouter } from 'react-router-dom';
import { App } from '@starasia/admin';
function Root() {
return (
<BrowserRouter>
<App
router={/* your routes */}
menus={/* your menus */}
logo={/* your logo */}
/>
</BrowserRouter>
);
}
export default Root;Using Individual Components
If you're using individual components from @starasia/admin, make sure they're also wrapped with a router provider:
import { BrowserRouter } from 'react-router-dom';
import { Sidebar, Header } from '@starasia/admin';
function MyApp() {
return (
<BrowserRouter>
<div>
<Header />
<Sidebar menus={menus} />
{/* Your other components */}
</div>
</BrowserRouter>
);
}Common Errors
Error: "Cannot read properties of undefined (reading 'recentlyCreatedOwnerStacks')"
This error occurs when components try to use React Router hooks without a router context. Make sure your application is wrapped with BrowserRouter or another router provider.
Solution:
// ✅ Correct
import { BrowserRouter } from 'react-router-dom';
function App() {
return (
<BrowserRouter>
{/* Your @starasia/admin components */}
</BrowserRouter>
);
}
// ❌ Incorrect
function App() {
return (
<>
{/* Missing BrowserRouter - will cause errors */}
</>
);
}Version Compatibility
IMPORTANT: This package is compatible with React 18 only. React 19 is NOT supported yet.
- React: ^18.2.0 (React 19 not supported)
- React DOM: ^18.2.0 (React 19 not supported)
- React Router DOM: ^6.23.0
If you're using React 19, you'll encounter errors like:
Cannot read properties of undefined (reading 'ReactCurrentDispatcher')Cannot read properties of undefined (reading 'recentlyCreatedOwnerStacks')
To fix these errors, downgrade to React 18:
npm install react@^18.2.0 react-dom@^18.2.0
# or
pnpm add react@^18.2.0 react-dom@^18.2.0License
ISC
Author
Prawito Hudoro
