In the previous post, we discussed the React Components to display the jobs list. The JobsList component calls the this.props.loadJobs() method when mounted. The Redux magic is woven inside in this method.
The following things happen during the invocation of loadJobs() method
Fetch the job postings from the server
Pass the job postings JSON to the jobsReducer
The jobsReducer modifies the state with the job postings
In the previous post, we set the premises for React-Redux application. Let’s discuss creating a job dashboard. We’ll concentrate on the front-end in this post.
The front-end application uses React and Redux and does the following.
Display a list of job postings from the server
Create a new job posting
Delete job posting
View job posting details
We’ll create an Express JS application that talks to an SQLite3 database. The jobs data is stored in SQLite3. We’ll get to this part quickly. For now, let’s assume that ExpressJS or the server application is running in http://localhost:3001. Our front-end application will perform calls to the server application.
create-react-app
Let’s create a React application, jobs-reactjs using the NodeJS utility, create-react-app. As we’re using Redux framework, let’s install the redux and react-redux modules. Shown below is the package.json file.
In the last two years, we have been working substantially with React JS. One of our ongoing projects, involves displaying plenty of records after search. The user manipulates these records by editing, deleting, sorting etc. Earlier, we used plain CoffeeScript with jQuery for this. When we started building this application, data size was small and things were lot more under our control. But as it grew, we could see obvious dip in the overall performance. The page rendering was slow, the manipulation became slower with time.
It was one of those late night working sessions, we took a decision to rewrite the whole application, using React JS. We first started to rewrite the pages that dealt with of lot of data. And now things are more under control, with most parts of the application using React JS.
Oh! Wait a sec!!! We used plain React JS with Rails, using react-rails gem. But things started getting messy when the data started flowing all over the places. And the data manipulation code was present everywhere haphazardly. So, React JS also started giving us problems, if not implemented properly. That’s where Redux came to the rescue.
Venkat Subramaniam‘s talks are funfairs. I have been listening to Venkat for the last 15 years and it’s only getting better. Last week I was fortunate to attend a day long session with Venkat in Chennai, organised by the Java User Group.
Entry of speakers to the hall invites myriad responses from the audience. When Venkat enters a conference hall to speak, people’s eyes brighten up, their faces immediately put up a nice smile and everyone turns their minds on to a charging mode. Yes, Venkat’s sessions charges you fully and lifts up your spirits.
The first talk was about ‘The Power and Perils of Parallel Streams‘. Venkat started with the Threading model and the API in Java and how it has evolved over a period of time. He introduced to the Stream API in Java 8 and discussed parallelism in it. A Few key take away points in this session: