• Activity
  • Votes
  • Comments
  • New
  • All activity
  • Showing only topics with the tag "web development". Back to normal view
    1. Honest Question: What benefits can I hope to achieve by switching from jquery to react?

      I'm a freelance coder who builds small-medium apps and my front-end stack primarily consists of Bootstrap+jquery. This combo has never let me down until now even with all kinds of features,...

      I'm a freelance coder who builds small-medium apps and my front-end stack primarily consists of Bootstrap+jquery. This combo has never let me down until now even with all kinds of features, functionality and complexity thrown at it. I've built dashboards with line charts, puzzles and MCQs, grids and tabular components to edit data, etc. and it was all very seamless.

      But when I keep hearing the discussions here and on other places in social media, they make me feel like I'm stuck in a very different century! There is no doubt that React is a well-known, popular and robust piece of software but one thing that dissuades me from getting into it is the whole monstrous npm system of components around it. It seems to be quite integrated with node when it comes to some react components like next, nuxt or whatever. Is it not possible to just like include react through CDN with link or script tags and still make good use of it?

      More specifically, I want to know what can I hope to achieve if I migrate from jquery to react? I'm quite tied to the jquery way of doing things right from DOM manipulation to event handling to things like cloning and reusing HTML components in <div> blocks. Is there any established guide or path for folks like us to migrate from jquery and react? And to begin with, is this a good idea even?

      22 votes
    2. Why do the arrow functions won't return "this" object in a jquery event handler?

      Consider the following simple jquery event handler code I've been using since ages: $("body").on("click", ".dome .btn", function() { console.log(".dome .btn onclick::"); console.log($(this)); });...

      Consider the following simple jquery event handler code I've been using since ages:

      $("body").on("click", ".dome .btn", function() {
      	console.log(".dome .btn onclick::");
      	console.log($(this));
      });
      

      The this object here returns the button element in question which is the proper way. But today, I decided to use arrow function just to upgrade myself with the modern times:

      $("body").on("click", ".dome .btn", () => {
      	console.log(".dome .btn onclick::");
      	console.log($(this));
      });
      

      But in this case, the this object won't return the button element. It will return the window object instead which is the parent of all parents! What kind of atrocious quirk is this? Few days ago, someone on the /r/webdev subreddit told me that arrow function is just a modern way of writing the old function(){} syntax.

      10 votes
    3. Honest Question: Why did PHP remove dynamic properties in 8.x?

      I understand PHP has had many criticisms in the past but I'm not sure the existence of dynamic properties of instantiated objects was ever one of them. In fact, dynamic properties are pretty much...

      I understand PHP has had many criticisms in the past but I'm not sure the existence of dynamic properties of instantiated objects was ever one of them. In fact, dynamic properties are pretty much the hallmark of most interpreted or dynamic programming languages. Python allows it all the time and so do many others like Ruby, Perl, etc.

      I don't know what PHP developers achieved by removing dynamic properties feature from the language but one thing that resulted out of this is that many applications based on widely used veteran PHP frameworks (such as CodeIgniter and CakePHP) came to a halt all of a sudden due to an error like this after upgrading to PHP 8:

      A PHP Error was encountered
      Severity: 8192
      Message: Creation of dynamic property CI_URI::$config is deprecated
      Filename: core/URI.php
      Line Number: 102
      Backtrace:
      File: C:\xampp\htdocs\inv_perpus\index.php Line: 288 Function: require_once
      

      The influence of Corporate IT in various open source foundations is pretty well known and also well known is the extent to which corporate greed goes to achieve its interests and objectives across the world. The only way to assuage this uncomfortable thought (at least in this particular case) is to ask if there was any technical merit at all in removing dynamic properties feature from a dynamic programming language?

      I for one couldn't find any such merit here.

      12 votes