Yuvraj Patil

Photo by Possessed Photography on Unsplash

Tests

Set variable value based on API’s response

var apiResponse = pm.response.json();// We can use JavaScript String methods like below:
var offset = apiResponse.access_token.substring(4,9);
pm.environment.set("oathToken", apiResponse.access_token);
pm.environment.set("timerOffset", offset);
// Concatenate String
pm.environment.set("bucketId", "Y-" + offset);

Add Delay before executing next API in Postman Runner

setTimeout(()=> {
var apiResponse = pm.response.json();
pm.environment.set("oathToken", apiResponse.access_token);
}, 10 * 1000); // 10 second delay

--

--

General

Create a React App with TypeScript template

npx create-react-app uv-app --template typescript

Functional Component

Frequently Used

Event Handling

<button onClick={activateLasers}>
Activate Lasers
</button>

Render List

{
students.map((obj: any, index: any) => (
<div key={index}> {obj.title} </div>
))
}

Conditional rendering

Type 1: If statement style

{props.hasImage &&
<MyImage />
}

Type 2: If else statement style

{props.hasImage ?
<MyImage /> :
<OtherElement/>
}

Hooks

useState

useEffect

useSelector

--

--

Yuvraj Patil

Yuvraj Patil

Loves coding and enjoys learning new technologies. Website: https://.yuvrajpatil.com