React functions inside render()

A function in the render method will be created each render which is a slight performance hit. It’s also messy if you put them in the render, which is a much bigger reason, you shouldn’t have to scroll through code in render to see the html output. Always put them on the class instead. For … Read more

What is the difference between User Control, Custom Control and Component?

The main difference between User Control, Custom Control and Component is that they inherit from different levels in the inheritance tree: MyComponent |-> Component MyCustomControl |-> Control |-> Component MyUserControl |-> ContainerControl |-> ScrollableControl |-> Control |-> Component So, in short you get a different amount of pre-wired functionality with the different options. When would … Read more

React showing 0 instead of nothing with short-circuit (&&) conditional component

Since your condition is falsy and so doesn’t return the second argument (<GeneralLoader />), it will return profileTypesLoading, which is a number, so react will render it because React skips rendering for anything that is typeof boolean or undefined and will render anything that is typeof string or number: To make it safe, you can … Read more

Vue – how to pass down slots inside wrapper component?

Vue 3 Same as the Vue 2.6 example below except: $listeners has been merged into $attrs so v-on=”$listeners” is no longer necessary. See the migration guide. $scopedSlots is now just $slots. See migration guide. Vue 2.6 (v-slot syntax) All ordinary slots will be added to scoped slots, so you only need to do this: <wrapper> … Read more

Clear controls does not dispose them – what is the risk?

Asking for modifications like this is pointless, the Windows Forms team has been disbanded quite a while ago. It is in maintenance mode, only security issues and OS incompatibilities are considered. It is otherwise simple enough to create your own method to do this: public static class ExtensionMethods { public static void Clear(this Control.ControlCollection controls, … Read more

How to run a jquery function in Angular 2 after every component finish loading

You will want to use the “ngAfterViewInit” lifecycle hook, through importing AfterViewInit (https://angular.io/docs/ts/latest/guide/lifecycle-hooks.html#!#afterview). You can use it as shown below: Installation: tsd install jquery –save or typings install dt~jquery –global –save Utilization: import { Component, AfterViewInit } from ‘@angular/core’; import * as $ from ‘jquery’; ngAfterViewInit() { this.doJqueryLoad(); this.doClassicLoad(); $(this.el.nativeElement) .chosen() .on(‘change’, (e, args) => … Read more

React: Passing props to function components

You would need to pass down each prop individually for each function that you needed to call <CreateProfile onFirstNameChange={this.firstNameChange} onHide={close} show={this.state.showModal} /> and then in the CreateProfile component you can either do const CreateProfile = ({onFirstNameChange, onHide, show }) => {…} with destructuring it will assign the matching property names/values to the passed in variables. … Read more

How to pass data between sibling components without using $scope?

Component approach I would suggest you to align with Angular 2 component approach and use inputs/outputs approach. If you do so, you will be able to easily migrate to Angular 2, because components will be conceptually identical (with difference only in syntax). So here is the way you do it. So we basically want header … Read more

What does OSGi solve?

what benefits does OSGi’s component system provide you? Well, Here is quite a list: Reduced Complexity – Developing with OSGi technology means developing bundles: the OSGi components. Bundles are modules. They hide their internals from other bundles and communicate through well defined services. Hiding internals means more freedom to change later. This not only reduces … Read more