Mohammad Towhidul Islam

    13-Jan-22 10:51:06 am

    optional chaining (?.) vs nullish coalescing (??) operators

    What Will Happen Before the Data is Ready? Look through your code and make sure it won’t blow up if the data isn’t ready (if the value is null). Be especially careful if the data is initialized to or can become null or undefined! {user && user.name ? user.name : "Not loaded yet&quo...

    Read More


    Mohammad Towhidul Islam

    13-Jan-22 10:44:31 am

    Fetch Data Before Render in the Parent

    If you absolutely need to run some code before a component renders, then the solution is to avoid rendering that component at all, until you’re ready. That means conditionally rendering it in the parent, which would look something like this. More detail in the comments: function Child({ items...

    Read More


    Mohammad Towhidul Islam

    13-Jan-22 10:41:08 am

    React class component's lifecycle method orders

    1 componentWillMount()2 set the initial state in the constructor3 render()4 componentDidMount()5 setState()6 render() Note : In any state change rend...

    Read More


    Mohammad Towhidul Islam

    11-Jan-22 12:34:26 pm

    React and Larave 8.x API

    Note: Assuming that you have a Laravel App as the following path: c:xampphtdocslaravelapp1 To create new Laravel app go to (c:xampphtdocslaravel) folder with command prompt and write the following command as: c:xampphtdocslaravel>composer create-project laravel/laravel app...

    Read More


    Mohammad Towhidul Islam

    26-Aug-20 01:46:55 am

    Consume A REST API With Axios Client

    Step 1: Install axios client >npm install axios Step 2: Import axios library import axios from 'axios' Step 3: And the get call the function as below axios.get(apiUrl).then((repos) => { console.log(repos.data); }); GET Example loadJSONaxios(){ ax...

    Read More


    Mohammad Towhidul Islam

    26-Aug-20 01:35:51 am

    Example of React JSON data with fetch() function

    import React, { Component } from 'react' export class Subject extends Component { constructor(props){ super(props); this.state={items:[],error: null,isLoaded: false}; } componentDidMount(){ this.loadJSON(); } loadJSON(){ ...

    Read More


    Mohammad Towhidul Islam

    26-Aug-20 01:01:49 am

    Example of ReactJS Ref and React.createRef()

    import React, { Component } from 'react' export class Contact extends Component { constructor(props){ super(props); this.state={name:"Jahid",message:""}; this.txtNameRef=React.createRef(); } componentDidMount(){ this.txtNameR...

    Read More


    Mohammad Towhidul Islam

    26-Aug-20 12:40:07 am

    Example of Basic React Routing

    App.js import React from 'react'; import ReactDOM from "react-dom"; import { BrowserRouter,Redirect, Link, Route, Switch } from "react-router-dom"; function Nav(){ return( <> <ul> <li><Link to="/da...

    Read More


    Mohammad Towhidul Islam

    26-Aug-20 12:26:08 am

    Example of ReactJS event handling?

    import React, { Component } from 'react' export class Message extends Component { constructor(props){ super(props) this.state={name:"Jahid",message:""} } messageHandler=()=>{ this.setState({message:"Thank you"}) } ...

    Read More


First12Last
1 of 2 pages
Copyright © 2024. Powered by Intellect Software Ltd