A starter kit to create comprehensive React apps with React-Query and Styled-Components.
Use create-react-prime for easy install.
npx create-react-prime my-app
cd my-app
npm start
package.json
for more details$ npm start
$ npm run build
$ npm run server
$ npm run clean
$ npm run lint
$ npm run analyzer
Make sure all modules are installed:
$ npm install
Create a build for production, this will add a /dist
folder to the root with all bundles.
$ npm run build
Run the server file to start server:
$ npm run server
For production we recommend to use PM2 to run the server with advanced process management.
The components are separated in common
, modules
and pages
.
common
folder includes components are self-contained and can be used through the entire appmodules
are bundled components which depend on each other.pages
folder contain top level pages of the applicationTo manage data throughout the while application this boilerplate makes use of React Query. A simple query is similar to the following code snippet:
export const useGetItems = () => {
return useQuery<ServerResponse, Error, ReselectedData>(
'items', // either a string, or an array
async () => await api.get({ path: '/users' }),
{
select: (response) => {
// format or select parts of the response
return response;
}
},
);
};