Showing posts with label Components. Show all posts
Showing posts with label Components. Show all posts

Thursday, October 11, 2018

Child component example in Angular 6

Angular applications are built with a set of components often nested set of components. We can embed a component inside another component using the nested components selector tag. Let us create a very basic child component and embed it in the home component.

Let us start with creating a child component using the following command

ng g c child

The command will create a component class file child.component.ts and a template file child.component.html. In this example we will not make any changes to the class file, we will add a simple message to the template file.

Friday, August 3, 2018

Inline styles example in React

There are different ways of adding styles to react components.
1. Inline styles.
2. CSS Stylesheet
3. CSS Modules

In this example we shall see on how to implement Inline styles in React components. The example uses styles defined in the same file as the react component and the style is applied to the component using className="<style name>"

Sunday, April 8, 2018

Advantages of React?

Virtual DOM
The first advantage of React over other JavaScript libraries is Performance.
React uses a concept called Virtual DOM which minimizes updates to the DOM and thereby reducing render time and increasing performance.