What do you want to save?
Add Code snippet
New code examples
-
Javascript 2021-11-20 18:35:15
create an observabloe js
// Requires RXJS 6+ // Create an observable of any Type // Ask yourself if the function creates a new observable or not // If it creates a new one then it is imported from 'rxjs' // Operators are imported from 'rxjs/operators' import { of } from 'rxjs'; ... Add solution -
TypeScript 2021-11-18 02:01:13
angular no internet detection
//Tested with Angular 8.1 and rxjs 6.5.2 import { Observable, Observer, fromEvent, merge } from 'rxjs'; import { map } from 'rxjs/operators'; ngOnInit(){ this.createOnline$().subscribe(isOnline => console.log(isOnline)); } createOnline$() { return m... Add solution -
Javascript 2021-11-03 16:04:18
proptypes for a react component
import PropTypes from 'prop-types'; MyComponent.propTypes = { // You can declare that a prop is a specific JS type. By default, these // are all optional. optionalArray: PropTypes.array, optionalBool: PropTypes.bool, optionalFunc: PropTypes.fun... Add solution -
Javascript 2021-10-25 11:42:20
reactnode prop-types
import PropTypes from 'prop-types'; MyComponent.propTypes = { // You can declare that a prop is a specific JS type. By default, these // are all optional. optionalArray: PropTypes.array, optionalBool: PropTypes.bool, optionalFunc: PropTypes.fun... Add solution -
TypeScript 2021-10-06 05:15:02
rxjs create observable from value
// Requires RXJS 6+ // Create an observable of any Type // Ask yourself if the function creates a new observable or not // If it creates a new one then it is imported from 'rxjs' // Operators are imported from 'rxjs/operators' import { of } from 'rxjs'; ... Add solution -
Javascript 2021-09-20 16:39:02
javascript rest parameters vs spread operator
/** * JS Spread and Rest operators: * Two operators with the same syntax (...) but behave differently */ // Rest parameter: collects all remaining elements into an array. function foo (...args) { console.log(args) } foo(1,2,3,4,5,6) // Output: (6) [1,... Add solution -
Javascript 2021-09-15 08:27:03
react proptypes example
import PropTypes from 'prop-types'; MyComponent.propTypes = { // You can declare that a prop is a specific JS type. By default, these // are all optional. optionalArray: PropTypes.array, optionalBool: PropTypes.bool, optionalFunc: PropTypes.fun... Add solution -
Javascript 2021-08-28 00:09:02
react proptypes
import PropTypes from 'prop-types'; MyComponent.propTypes = { // You can declare that a prop is a specific JS type. By default, these // are all optional. optionalArray: PropTypes.array, optionalBool: PropTypes.bool, optionalFunc: PropTypes.fun... Add solution