Environment variables is of the best ways to differentiate/decouple between react and it’s server side dependency. In order to do so let’s take webpack as an example and download dotenv for webpack with npm or yarn: yarn add –dev dotenv webpack-dotenv or npm install dotenv webpack-dotenvĀ –save Add the following codeContinue Reading

1. Hidden form fields Example Basic HTML: <form action=”ServerActionName” method=”post”><input type=”hidden” value=”hidden value let’s say yellow” name=”color” /> </form> The pro is that it is simple and works for simple cases. The con is that everypage must have a form that has a hidden input field in order to moveContinue Reading

Creating a reducer example: let’s say we have a file- account.reducer.ts export function reducer(state, action) { switch (action.type) { case ‘UPDATE_ACCOUNT_STATUS’: return { …state, accountStatus: action.payload }; default: return state; } } Then in another file let’s say app.module.ts we import the reducer for root import { StoreModule } fromContinue Reading

State data can be view data, user information, entity data, user selection or input and any other data that the application tracks .. what to do with so much data??? how to upkeep it ? how to notify it globally? Here comes, NgRx which is a reactive library for angularContinue Reading