Writing React with PRIMEREACT

claireliao
1 min readOct 9, 2021

--

If you are not ready with a react project, you can visit this post to set up one:

And in this series, we will be based on redux & typescript.

In this series I am going to write some sample code using PRIMEREACT & Typescript, there are few sample codes I can find when I first started to learn to React with Typescript. So, I’d like to provide some by myself.

0. Install

Install the required libraries for PRIMEREACT

npm i primereact primeicons primeflex@2.0.0 primeicons react-transition-group 

1. Import CSS when you use it.

import 'primeicons/primeicons.css';
import 'primereact/resources/themes/saga-blue/theme.css';
import 'primereact/resources/primereact.css';
import 'primeflex/primeflex.css';

2. Change import component name

If you also use other libraries at the same time, you might avoid the same import name. Then you can use the following way to change the import name.

import {originName as newNameYouWant} from 'primereact/....'

--

--