import React, { useState, useEffect } from "react";
Sunday, 20 February 2022
React - Multiple HTTP API call using Axios.all &&& Promise.all - fill in ag-grid-react
Wednesday, 16 February 2022
Convert Array of Object to array AND array to Array of Object - using map function in JS/TS
Convert JSON ARRAY to Array
=========================
var someJsonArray = [
{id:1, name: 'name1', property:'value1'},
{id:2, name: 'name2', property:'value2'},
id:3, name: 'name3', property:'value3},
];
using Arrow function:
-------------------------
var arrayData = someJsonArray.map( item => item.property )
/// output is ::: ['value1', value2','value3'];
///using without Arrow (=>) function
-----------------------------------------------
var arrayData someJsonArray.map( function(item) { return item.property; } );
Convert ARRAY to JSON Array
=========================
var arr = ['value1', value2','value3'];
let JsonArr = arr.map( val => { "key": val,"name": val, "value": val }
// this case all the key values same data [{key:1, name: 'name1', val:'value1'}, {}, {}]
without Arrow Function( => )
let JsonArr = arr.map( function(val)=> { return {"name": val, "value": val } });
Wednesday, 9 February 2022
How to deploy a React App to github Pages with github Actions:
How to deploy a React App to github Pages with github Actions:
===============================================================
create a repo in github.
Clone the peoject and then create react application
npx create-react-app react-github-pages-actions
npm install
npm i gh-pages --save-dev
add the package.json
{
"name": "react-github-pages-actions",
THEN "homepage": "https://[GITHUB_USERNAME}.github.io/react-github-pages-actions {project name}
...
...
}
,
"scripts": {
"predeploy": "npm run build",
"deploy" : "gh-pages -d build", // gh-pages is ceate a new branch to deploy from the branch merge the feature branch into main branch
// from main to gh-page will carete clone
"start": "react-script start",
....
....
...
}
Once the development is completed, run predeploy cmd
THEN run the deploymnet command
goto github -> settings -> pages -> you can see the url is deploy in github pages.
We can change the branch name and post the root/ docs save
Addding Github actions to react project:
---------------------------------------
create .github folder in the project root directory inside create another directory -> workflow (folder ) -> then create file workflow.yml
Claude Code worflow
The Claude code task cycle 1. Gater context Reads files, explore projec structure, code base 2. Plan Break the task in to steps 3. Exe...
-
Top 10 Web Application Security Risks There are three new categories, four categories with naming and scoping changes, and some consolidat...
-
Cross browser testing - automation framework-cypress,playwrite; CloudBorwser -saucelabs browserstackEvaluating cross-browser testing for a React application involves assessing both functional consistency (JavaScript/API behavior) and v...