Lanka Developers Community

    Lanka Developers

    • Register
    • Login
    • Search
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Shop
    1. Home
    2. dev_lak
    3. Posts
    • Profile
    • Following 5
    • Followers 28
    • Topics 31
    • Posts 460
    • Best 151
    • Controversial 0
    • Groups 3

    Posts made by dev_lak

    • RE: Xamarin Mobile Development - English Tutorials will begin soon...

      @lahirunc it'll be great :heart:

      posted in Hybrid App Development
      dev_lak
      dev_lak
    • RE: Xamarin Mobile Development - English Tutorials will begin soon...

      waiting for this :heart:

      posted in Hybrid App Development
      dev_lak
      dev_lak
    • RE: Stepping on Unreal Engine for the First Time

      @ciaompe exactly brother....

      posted in Game Development
      dev_lak
      dev_lak
    • RE: Xamarin Mobile Development - Anyone interested?

      interested...

      posted in Hybrid App Development
      dev_lak
      dev_lak
    • RE: Stepping on Unreal Engine for the First Time

      thanks bro... :hearts:

      posted in Game Development
      dev_lak
      dev_lak
    • RE: New Data Science and Machine Learning Workshop

      interesting

      posted in AI Programming
      dev_lak
      dev_lak
    • RE: [Guide] Online Passive Income By Blogging

      nice explanation, thanks bro

      posted in Blogs
      dev_lak
      dev_lak
    • RE: Agile methodology in software development

      good post

      posted in Blogs
      dev_lak
      dev_lak
    • RE: Download Free Courses(Web design + Programming + Frameworks + Graphic Design + Music Production)

      thanks bro

      posted in Announcements
      dev_lak
      dev_lak
    • React JS Intro

      0_1545988991425_reac.png

      What is React JS

      • React is a JavaScript library for building user interfaces.

      React Components

      • Everything in React is a component, and these usually take the form of JavaScript classes. You create a component by extending upon the React-Component class.
        Eg:

        class MyComponent extends React.Component {
            render() {
                return <h1>Hello world!</h1>;
            }
        }
        
      • You then define the methods for the component. In our example, we only have render() method.

      • Inside render() you’ll return a description of what you want React to draw on the page. In the case above, we simply want it to display an h1 tag with the text Hello world! inside it.

      Props and States

      • There are two types of data in React: props and state.

      • The key difference is that state is private and can be changed from within the component itself. Props are external, and not controlled by the component itself. It’s passed down from components higher up the hierarchy, who also control the data.

      • The difference between the two is a bit tricky to understand in the beginning, so don’t worry if you find it a bit confusing. i'll show you how to work with props and states in the next tutorial.

      Setting Up

      • First create a .html file

      • Then import react like below

        <!-- ... other HTML ... -->
        
          <!-- Load React. -->
          <!-- Note: when deploying, replace "development.js" with "production.min.js". -->
          <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin>    </script>
          <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
        
        </body>
        

      Add a DOM Container to the HTML

      • Add an empty <div> tag to mark the spot where you want to display something with React. For example:

        <!-- ... existing HTML ... -->
        
        <div id="save_button_container"></div>
        
        <!-- ... existing HTML ... -->
        
      • We gave this <div> a unique id HTML attribute. This will allow us to find it from the JavaScript code later and display a React component inside of it.

      Creating a React Component

      • Create a file called save_button.js next to your HTML page.

      • Add below code to save_button.js file

        'use strict';
        
        const e = React.createElement;
        
        class SaveButton extends React.Component {
          constructor(props) {
            super(props);
            this.state = { saved: false };
          }
        
          render() {
            if (this.state.liked) {
              return 'You saved this.';
            }
        
            return e(
              'button',
              { onClick: () => this.setState({ saved: true }) },
              'Save'
            );
          }
        }
        
        //These two lines of code find the <div> we added to our HTML in the last step, and then display our “Save” button React component inside of it.
        const domContainer = document.querySelector('#save_button_container');
        ReactDOM.render(e(SaveButton), domContainer);
        

      Loading our React Component

      <!-- ... other HTML ... -->
      
        <!-- Load our React component. -->
        <script src="save_button.js"></script>
      
      </body>
      
      • Open the .html file you create using your favourite browser and you will see something like below:

      0_1545987958832_d79088ee-6b1c-4907-a2d8-1bdf0470a236-image.png

      Full Example

      • index.html

        <html>
        <head>
            <title>React App</title>
        </head>
            <body>
                <h1>Welcome to my React App</h1>
                <div id="save_button_container"></div>
        
                <!-- Load React. -->
                <!-- Note: when deploying, replace "development.js" with "production.min.js". -->
                <script src="https://unpkg.com/react@16/umd/react.development.js" crossorigin></script>
                <script src="https://unpkg.com/react-dom@16/umd/react-dom.development.js" crossorigin></script>
        
                <!-- Load our React component. -->
                <script src="save_button.js"></script>
            </body>
        </html>
        
      • save_button.js

        'use strict';
         
        const e = React.createElement;
         
        class SaveButton extends React.Component {
          constructor(props) {
            super(props);
            this.state = { saved: false };
          }
         
          render() {
            if (this.state.liked) {
              return 'You saved this.';
            }
         
            return e(
              'button',
              { onClick: () => this.setState({ saved: true }) },
              'Save'
            );
          }
        }
         
        //These two lines of code find the <div> we added to our HTML in the last step, and then display our “Save” button React component inside of it.
        const domContainer = document.querySelector('#save_button_container');
        ReactDOM.render(e(SaveButton), domContainer);
        

      Thanks for reading, in the next tutorial i'll talk about

      • Props and States
      posted in Front-End Development
      dev_lak
      dev_lak
    • RE: Installing Unreal Engine

      nice bro.. :heart:

      posted in Game Development
      dev_lak
      dev_lak
    • RE: Free DATA SCIENCE AND MACHINE LEARNING WORKSHOP at Microsoft Sri Lanka

      @uditha thanks for sharing

      posted in AI Programming
      dev_lak
      dev_lak
    • RE: Node.js : Introduction - Part 2

      @sudo niyamai machan... :heart:

      posted in Back-End Development
      dev_lak
      dev_lak
    • RE: AngularJS Guide Part 1 - English

      @root thanks

      posted in Front-End Development
      dev_lak
      dev_lak
    • AngularJS Guide Part 1 - English

      0_1545405228808_angularjs.jpg

      Angular JS is a client side MVC/MVVM Framework, this is created by google so most of developers adopted to angular js. This is very popular for single page web applications and also we can do lot of things using angular js. Ionic framework is best example that showing power of angular which is used to make Hybrid Mobile Applications using HTML, CSS and Javascripts only.

      To install the Angular JS we want Node JS on our computer, and we use Angular CLI to create, test, build and deploy our angular app.

      Installing Node JS


      www.nodejs.org go to this website and download right package match to your OS. You can find out instructions on that page

      Installing Angular


      After installing node js we need to install Angular CLI, to install that open your terminal and run

      npm install -g @angular/cli
      

      Creating an Angular App


      After installing Angular CLI, navigate to where you want to create angular project and then run following command in the terminal

      ng new my-app //my-app is your project name
      

      When you run this command it will ask you information about your app, for now just press enter, we can change these info later

      Running our Angular App


      Navigate to your app directory

      cd my-app
      

      After you navigating to app folder you can run your app using ng-serve command. When you run this command it will start a local server and when you made a change it will automatically reloads the app(auto reloading) this is a very useful feature.

      ng serve --open
      

      When you run above command it will automatically open the app using default web browser(http://localhost:4200/), if not try rerunning the command. On successful execution you can see like below

      0_1545407172540_1545302907665-app-works.png

      On the next step i'll show you how to edit our app. If you have any question just ask on lankadevelopers.com our members will help you.

      Originally posted by @ciaompe
      This is translated cause of most peoples are requesting an english version.

      Source : https://angular.io/guide/quickstart

      posted in Front-End Development
      dev_lak
      dev_lak
    • RE: Sinhala Tutorials

      thanks for sharing

      posted in Web Development
      dev_lak
      dev_lak
    • RE: I want to change map icon as location condition

      @akashmanujaya welcome bro...

      posted in Back-End Development
      dev_lak
      dev_lak
    • RE: I want to change map icon as location condition

      try

      icon :   locations[i][6] == 3 ?  black_icon  : purple_icon,
      
      posted in Back-End Development
      dev_lak
      dev_lak
    • RE: I want to Enter my radio button value to the database in php

      @akashmanujaya i have done small change to code, try this

      function saveData() {
              var confirmed = document.getElementById('confirmed').checked ? 1 : 0;
              var id = document.getElementById('id').value;
              var Condition=$('input[name="Condition"]:checked').val(); //check this line
       
              var fd = new FormData();
       
              fd.append('confirmed', confirmed);
              fd.append('id', id);
              fd.append('Condition',Condition); //uncomment this line
      }
      
      posted in Back-End Development
      dev_lak
      dev_lak
    • RE: I want to Enter my radio button value to the database in php

      @akashmanujaya i'll check

      posted in Back-End Development
      dev_lak
      dev_lak
    • 1
    • 2
    • 19
    • 20
    • 21
    • 22
    • 23
    • 22 / 23