Using mixins vs components for code reuse in Facebook React

Update: this answer is outdated. Stay away from the mixins if you can. I warned you! Mixins Are Dead. Long Live Composition At first, I tried to use subcomponents for this and extract FormWidget and InputWidget. However, I abandoned this approach halfway because I wanted a better control over generated inputs and their state. Two … Read more

Mixin vs inheritance

A mixin is typically used with multiple inheritance. So, in that sense, there’s “no difference”. The detail is that a mixin is rarely useful as a standalone object. For example, say you have a mixin named “ColorAndDimension”, which adds a color property and width and height. Now, you could add ColorAndDimension to a, say, Shape … Read more

Mixins vs. Traits

Mixins may contain state, (traditional) traits don’t. Mixins use “implicit conflict resolution”, traits use “explicit conflict resolution” Mixins depends on linearization, traits are flattened. Lecture about traits ad 1. In mixins you can define instance variables. Traits do not allow this. The state must be provided by the composing class (=class using the traits) ad … Read more

Sass – Converting Hex to RGBa for background opacity

The rgba() function can accept a single hex color as well decimal RGB values. For example, this would work just fine: @mixin background-opacity($color, $opacity: 0.3) { background: $color; /* The Fallback */ background: rgba($color, $opacity); } element { @include background-opacity(#333, 0.5); } If you ever need to break the hex color into RGB components, though, … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)