Skip to content

Instantly share code, notes, and snippets.

samuel ogundipe samuelayo

Block or report user

Report or block samuelayo

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View range.js
// Task: Implement a 'Range Collection' class.
// A pair of integers define a range, for example: [1, 5). This range includes integers: 1, 2, 3, and 4.
// A range collection is an aggregate of these ranges: [1, 5), [10, 11), [100, 201)
/**
* RangeCollection class
* NOTE: Feel free to add any extra member variables/functions you like.
*/
class RangeCollection {
constructor() {
View test.js
const list = [
{ name: 'test a', ranking: 3 },
{ name: 'test b', ranking: 7 },
{ name: 'test c', ranking: 8 },
{ name: 'test d', ranking: 2 },
{ name: 'test e', ranking: 5 },
{ name: 'test f', ranking: 2 },
{ name: 'test g', ranking: 6 },
{ name: 'test h', ranking: 7 },
{ name: 'test i', ranking: 9 },
View gist.js
"scripts": {
"dev": "next",
"build": "next build",
"start": "next start"
}
View app.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
import FirstComponent from './src/FirstComponent'
import UserComponent from './src/UserComponent'
ReactDOM.render(
<div>
<h1>Hello, Welcome to the first page</h1>
<FirstComponent/>
<UserComponent name="Logrocket" age={105} address="get me if you can" dob={new Date()} />
View UserComponent.ts
import * as React from "react";
import UserInterface from './UserInterface'
export default class UserComponent extends React.Component<UserInterface, {}> {
constructor (props: UserInterface){
super(props);
}
View UserInterface.ts
export default interface User{
name: string;
age: number;
address: string;
dob: Date;
}
View app.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
import FirstComponent from './src/FirstComponent'
ReactDOM.render(
<div>
<h1>Hello, Welcome to the first page</h1>
<FirstComponent/>
</div>,
document.getElementById("root")
);
View FirstComponent.tsx
import * as React from "react";
let Logo ="https://logrocket.com/img/logo.png";
export default class FirstComponent extends React.Component <{}> {
render() {
return (
<div>
View index.html
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Getting Started with Typescript and ReactJS</title>
</head>
<body>
<!-- this is where react renders into -->
<div id="root"></div>
View app.tsx
import * as React from "react";
import * as ReactDOM from "react-dom";
ReactDOM.render(
<div>
<h1>Hello, Welcome to the first page</h1>
</div>,
document.getElementById("root")
);
You can’t perform that action at this time.