<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Lucas Maués</title>
    <description>The latest articles on DEV Community by Lucas Maués (@lucasm).</description>
    <link>https://dev.to/lucasm</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F102538%2F2f007f14-18c2-4ec2-8c6b-ad1ef901d24c.png</url>
      <title>DEV Community: Lucas Maués</title>
      <link>https://dev.to/lucasm</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/lucasm"/>
    <language>en</language>
    <item>
      <title>Why less UI is better than more?</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Wed, 31 Jul 2024 12:26:07 +0000</pubDate>
      <link>https://dev.to/lucasm/why-the-best-frontend-developers-and-ux-designers-produce-less-ui-2cip</link>
      <guid>https://dev.to/lucasm/why-the-best-frontend-developers-and-ux-designers-produce-less-ui-2cip</guid>
      <description>&lt;p&gt;Hey guys!&lt;/p&gt;

&lt;p&gt;In this article I will explain why the &lt;em&gt;simplicity&lt;/em&gt; often leads to superior user experiences and better business outcomes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Less is more
&lt;/h2&gt;

&lt;p&gt;Someday I woke up early and play a video of Don Norman... &lt;/p&gt;

&lt;p&gt;Just for remember what are the good principles of UX Design and Human–Computer Interaction.&lt;/p&gt;

&lt;p&gt;Don Norman is a king in the field of interaction design and UX. He is known for his work on the importance of usability and user-centered design.&lt;/p&gt;

&lt;p&gt;Norman argues that "design should be invisible" and that the best interface is one that the user barely notices. He emphasizes that design should minimize the need for learning and reduce the cognitive load on users, allowing them to perform their tasks efficiently and effectively.&lt;/p&gt;

&lt;p&gt;On the Web development, is a growing recognition that "less can indeed be more". The best Frontend Developers and UX Designers understand that their goal is not to overwhelm users with numerous interactions and flashy elements, but rather to create effective and efficient user interfaces (UIs) on websites and apps.&lt;/p&gt;

&lt;p&gt;PHILOSOPHIZING: &lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Even on the nature, the design of nature forms are only the necessary to make things done.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;PRO TIP:&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;Please, don't use the term "intuitive", if YOU DON'T KNOW how the mind of users works. So, make tests and UX research, before say that.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;h2&gt;
  
  
  The power of simple UI
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;ENHANCED Usability&lt;/strong&gt;: Simple interfaces are easier to navigate. Users can find what they need quickly without getting lost in a sea of buttons, menus, and options. By minimizing the number of elements on the screen, designers can guide users towards their goals more effectively.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Cognitive Load REDUCED&lt;/strong&gt;: When users encounter a cluttered interface, they have to spend more mental energy figuring out what to do. This cognitive load can lead to frustration and abandonment. A minimalist approach reduces this load, making interactions smoother and more enjoyable.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;FASTER Load Times&lt;/strong&gt;: Fewer elements mean less data to load. This can significantly improve page load times, which is crucial for user retention. In a world where users expect instant results, a fast, clean interface can make a big difference.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;FOCUS on Content&lt;/strong&gt;: By stripping away unnecessary elements, designers can ensure that the primary content stands out. This helps users focus on what truly matters, whether it’s reading an article, purchasing a product, or filling out a form.&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  The excessive UI is BAD
&lt;/h2&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;User confusion&lt;/strong&gt;: Overloading an interface with too many options can confuse users, making it difficult for them to decide on their next action. This confusion can lead to higher bounce rates and lower conversion rates.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Hidden costs&lt;/strong&gt;: Excessive UI elements can hide critical information, leading to poor user decisions. For example, in the financial sector, hidden fees or complex terms can lead to user dissatisfaction and mistrust.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Increased maintenance&lt;/strong&gt;: More elements mean more potential points of failure. Keeping a UI simple reduces the risk of bugs and makes maintenance easier and less costly.&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;&lt;strong&gt;Low technical capacity&lt;/strong&gt;: It's very easy to just put a button for everything. Making something simple and effective requires a deep understanding of the user's and business's needs. Something that few professionals are interested in pursuing. (thanks to @evertjr on X)&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;




&lt;h2&gt;
  
  
  UX ethics considerations
&lt;/h2&gt;

&lt;p&gt;There are real-world scenarios where things go worse.&lt;/p&gt;

&lt;p&gt;Some industries (such as insurers, banks, telecom...) are universally known for often use "Dark Patterns", to manipulate users into actions that benefit the company. &lt;/p&gt;

&lt;p&gt;This are developed as a feature.&lt;/p&gt;

&lt;p&gt;This practice is widely regarded as unethical on the good books of UX and Human–Computer Interaction, or even in some legislations. These dark patterns can include:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Complicated cancel/delete processes&lt;/strong&gt;: Making it hard to cancel subscriptions or services, and exclusion of accounts or personal data.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Hidden costs&lt;/strong&gt;: Concealing fees or charges within fine print.&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Deceptive design&lt;/strong&gt;: Tricking users into purchasing additional services or products they don’t need.&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;Using such tactics might bring short-term gains, but it usually results in long-term damage to the company's reputation and customer trust.&lt;/p&gt;




&lt;h2&gt;
  
  
  Insights from experts
&lt;/h2&gt;

&lt;blockquote&gt;
&lt;p&gt;"The best designs are those that are intuitive, requiring the minimum amount of cognitive load from the user. Complexity is acceptable, as long as it is understandable and necessary. We should avoid unnecessary complications." — Don Norman&lt;/p&gt;

&lt;p&gt;"Don't make me think." &lt;br&gt;
— Steve Krug&lt;/p&gt;

&lt;p&gt;"Simplicity can only be achieved through hard work." &lt;br&gt;
— Clarice Lispector&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;BOOKS RECOMMENDATIONS:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://amzn.to/3A5jjTn" rel="noopener noreferrer"&gt;The Design Of Everyday Things&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amzn.to/46JtyJr" rel="noopener noreferrer"&gt;Don't Make Me Think, Revisited: A Common Sense Approach to Web Usability&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;TAKE ACTION:&lt;/p&gt;

&lt;p&gt;No matter your position, whether it’s Dev or another, talk to your Design and Product team if you’ve found areas to improve and reduce complexity. Validate whether it’s worth implementing. The important thing is that you’re paying attention to simplify the user experience.&lt;/p&gt;




&lt;h3&gt;
  
  
  Conclusion
&lt;/h3&gt;

&lt;p&gt;The best Frontend Developers and UX Designers strive to produce less UI not because they are lazy or lack creativity, but because they understand the profound impact of simplicity. Simplicity and transparency in our designs, build trust and satisfaction among our users.&lt;/p&gt;

&lt;blockquote&gt;
&lt;p&gt;By embracing &lt;strong&gt;minimalism&lt;/strong&gt; and prioritizing &lt;strong&gt;user needs&lt;/strong&gt;, both developers and designers can create efficient, and ethical interfaces, that enhance the user experience, producing successful interactions for better business outcomes.&lt;/p&gt;
&lt;/blockquote&gt;




&lt;p&gt;I hope you enjoyed! ✌🏻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you have any comments?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Support my work &lt;a href="https://buymeacoffee.com/lucasm" rel="noopener noreferrer"&gt;☕️ Buy me a coffee&lt;/a&gt;&lt;/p&gt;

</description>
      <category>frontend</category>
      <category>ux</category>
      <category>design</category>
      <category>beginners</category>
    </item>
    <item>
      <title>Don’t do it on Frontend or... Frontend good practices for devs</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Thu, 19 Oct 2023 20:31:47 +0000</pubDate>
      <link>https://dev.to/lucasm/frontend-best-practices-guide-or-dont-do-it-on-frontend-32n4</link>
      <guid>https://dev.to/lucasm/frontend-best-practices-guide-or-dont-do-it-on-frontend-32n4</guid>
      <description>&lt;h3&gt;
  
  
  Console logs
&lt;/h3&gt;

&lt;p&gt;Delete.&lt;/p&gt;

&lt;p&gt;It's important to remove console.log in production code to prevent sensitive information leaks and enhance performance.&lt;/p&gt;

&lt;h3&gt;
  
  
  Console errors and warnings
&lt;/h3&gt;

&lt;p&gt;Investigate and fix.&lt;/p&gt;

&lt;p&gt;It's important to address console errors in production code to maintain a smooth and error-free user experiences.&lt;/p&gt;

&lt;h3&gt;
  
  
  Any in TypeScript
&lt;/h3&gt;

&lt;p&gt;Do the correct typing.&lt;/p&gt;

&lt;p&gt;Using &lt;code&gt;any&lt;/code&gt; in TypeScript should be minimized in favor of explicit types to enhance code reliability and maintainability.&lt;/p&gt;

&lt;h3&gt;
  
  
  Comment unused code
&lt;/h3&gt;

&lt;p&gt;Delete.&lt;/p&gt;

&lt;p&gt;Commenting out unused code is bad practice as it clutters the code, hinders maintenance, and may lead to outdated comment information.&lt;/p&gt;

&lt;h3&gt;
  
  
  Super Components and Functions
&lt;/h3&gt;

&lt;p&gt;If your component is large, the time has come to divide it into smaller components.&lt;/p&gt;

&lt;p&gt;Think about the good old principle of SOLID called &lt;em&gt;Single Responsibility&lt;/em&gt;.&lt;/p&gt;

&lt;p&gt;Whether you are writing functional or class code.&lt;/p&gt;

&lt;h3&gt;
  
  
  Rewrite CSS multiple times
&lt;/h3&gt;

&lt;p&gt;For the love of Ada Lovelace, Alan Turing and Tim Berners Lee...&lt;/p&gt;

&lt;p&gt;Don't rewrite colors, fonts and sizes repeatedly, use design tokens to your advantage, create global CSS variables or use libs.&lt;/p&gt;

&lt;p&gt;Talk to your team about the advantages of using design tokens.&lt;/p&gt;

&lt;h3&gt;
  
  
  Flags to ignore Linter
&lt;/h3&gt;

&lt;p&gt;Example: use &lt;code&gt;/* eslint-disable @typescript-eslint/no-unused-vars */&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Fix your code. &lt;/p&gt;

&lt;p&gt;Don't send Pull Requests with linter errors.&lt;/p&gt;

&lt;p&gt;If you really need to ignore, think carefully about which linter warnings you can do so.&lt;/p&gt;

&lt;h3&gt;
  
  
  Re-renders and loops consuming to many resources or crashing
&lt;/h3&gt;

&lt;p&gt;Example: JavaScript loop functions or useEffect in React poorly applied.&lt;/p&gt;

&lt;p&gt;This may cause infinite repetition in API calls or values that can overflow memory and crash your application.&lt;/p&gt;

&lt;p&gt;Fix your logic.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Note: your application runs in the browser and consumes limited end-user memory resources.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Business rules on the Frontend
&lt;/h3&gt;

&lt;p&gt;Do not place and do not allow.&lt;/p&gt;

&lt;p&gt;It is commonly agreed that any Frontend application cannot have business rules, only rules inherent to the user interface, for interaction and the user's successful journey.&lt;/p&gt;

&lt;p&gt;Frontend is the client, not the server.&lt;/p&gt;

&lt;p&gt;Large companies and enterprise-level applications adopt the practice of not exposing their business rules and data processing on the Frontend, placing them on the Backend.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Note: for simple, serverless web applications or those that consult third-party APIs, it may be necessary to place some business rules in the Frontend - being careful not to expose sensitive or very costly processing to the client.&lt;/li&gt;
&lt;/ul&gt;

&lt;h3&gt;
  
  
  Culture of not testing
&lt;/h3&gt;

&lt;p&gt;Make tests happen on your codebase. No code is perfect.&lt;/p&gt;

&lt;p&gt;Unit, Integration, Security, UX, Performance and Accessibility Tests. Use testing tools to generate error reports and improvements to correct your application.&lt;/p&gt;

&lt;p&gt;Example: Cypress, Lighthouse, SAST in the deploy pipeline, etc.&lt;/p&gt;

&lt;p&gt;Work in partnership with the UX, QA and Cybersecurity/Pentest teams if they exist on your company.&lt;/p&gt;

&lt;h3&gt;
  
  
  Fear of communication
&lt;/h3&gt;

&lt;p&gt;You are a human.&lt;/p&gt;

&lt;p&gt;Please, whenever you are stuck, call another Dev or Technical Lead to share the problem you are facing.&lt;/p&gt;

&lt;p&gt;Problems are solved faster through pair programming and thinking together! &lt;/p&gt;

&lt;p&gt;Remember: They were once in your position and will help!&lt;/p&gt;




&lt;p&gt;I hope you enjoyed! 😃✌🏻&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Do you have any more TIPS?&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;Support my work &lt;a href="https://buymeacoffee.com/lucasm" rel="noopener noreferrer"&gt;☕️ Buy me a coffee&lt;/a&gt;&lt;/p&gt;

</description>
      <category>webdev</category>
      <category>frontend</category>
      <category>javascript</category>
      <category>beginners</category>
    </item>
    <item>
      <title>TypeScript Documentary: the Web evolved with types!</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Sun, 24 Sep 2023 20:04:02 +0000</pubDate>
      <link>https://dev.to/lucasm/review-of-typescript-documentary-the-web-evolved-with-types-3af1</link>
      <guid>https://dev.to/lucasm/review-of-typescript-documentary-the-web-evolved-with-types-3af1</guid>
      <description>&lt;p&gt;Hey Devs!&lt;/p&gt;

&lt;p&gt;I watched the TypeScript Documentary (rating 8/10)&lt;/p&gt;

&lt;p&gt;I'm here to share my thoughts.&lt;/p&gt;

&lt;p&gt;TypeScript currently helps a lot of people.&lt;/p&gt;

&lt;p&gt;VS Code, React, Angular, Vue, Google, Airbnb, Meta, Yarn, Vercel, Deno, ES Lint, Slack, GitHub, Microsoft and several other companies (yours probably), frameworks and dev tools uses TypeScript.&lt;/p&gt;

&lt;p&gt;It's a necessary evolution for the Web - it would happen one time or another - Flow failed, Dart followed other paths, and AtScript merged with TypeScript.&lt;/p&gt;

&lt;p&gt;TypeScript benefited the entire Web.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why TypeScript?
&lt;/h2&gt;

&lt;p&gt;Simple:&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;1) Adds static typing to JavaScript language&lt;/strong&gt; and increases programming security, as we can identify errors before running the code;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;2) Transpiles code&lt;/strong&gt; (Converts TypeScript code into compatible JavaScript. That is, it uses the latest features of ECMAScript, such as classes, arrow functions, async/await and modules, which are not available in older versions of JavaScript. TypeScript transpiles .ts code into JavaScript compatible with older versions, such as ES5, to work in browsers and environments that do not support the latest ECMAScript features);&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;3) Integrates into MANY tools&lt;/strong&gt; and IDEs;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;4) Helps the TC39 working group&lt;/strong&gt; specify and define new standards for JavaScript;&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;5) It is built collaboratively&lt;/strong&gt; under the open source community.&lt;/p&gt;

&lt;h2&gt;
  
  
  What motivated?
&lt;/h2&gt;

&lt;p&gt;Many Software Engineers needed to scale JavaScript, but a few years ago it was impractical to work efficiently with multiple people on a team using pure JavaScript.&lt;/p&gt;

&lt;p&gt;They found the best solutions, leaving aside the Meta x Google x Microsoft competition.&lt;/p&gt;

&lt;p&gt;In a healthy (and intelligent) way, Satya Nadella management embraced open source in MS's business model and supported the TypeScript working group, which today is an open source project that benefits the entire Web platform.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Watch the TypeScript Docucmentary!&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;It's a class about the Web as a platform.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;*** Rating 8/10 because it only showed elite Devs, it failed to show the common Devs who help with the project.&lt;/p&gt;

&lt;h2&gt;
  
  
  Video - TypeScript Documentary:
&lt;/h2&gt;

&lt;p&gt;&lt;iframe width="710" height="399" src="https://www.youtube.com/embed/U6s2pdxebSo"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Link - TypeScript Website: &lt;a href="https://www.typescriptlang.org/" rel="noopener noreferrer"&gt;https://www.typescriptlang.org/&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;I hope you enjoy it!&lt;/p&gt;

</description>
      <category>typescript</category>
      <category>javascript</category>
      <category>webdev</category>
      <category>programming</category>
    </item>
    <item>
      <title>Amazing native Modal with HTML dialog element</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Wed, 02 Aug 2023 04:21:09 +0000</pubDate>
      <link>https://dev.to/lucasm/amazing-native-modal-with-just-html-meet-element-4jpl</link>
      <guid>https://dev.to/lucasm/amazing-native-modal-with-just-html-meet-element-4jpl</guid>
      <description>&lt;p&gt;The Web as a platform is constantly evolving. And I love it!&lt;/p&gt;

&lt;p&gt;Developers no longer need to create complex logics to have a Popup / Modal component in your Web applications.&lt;/p&gt;

&lt;p&gt;The HTML &lt;code&gt;dialog&lt;/code&gt; element and it's associated events allow you to create fast and accessible native custom dialog boxes.&lt;/p&gt;




&lt;h2&gt;
  
  
  Top features
&lt;/h2&gt;

&lt;p&gt;All these features below are native of the Dialog element and the browser implementation:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;Events (open, close, cancel)&lt;/li&gt;
&lt;li&gt;Autofocus on opened dialog (just press "tab" key to navigate inside)&lt;/li&gt;
&lt;li&gt;Closes when the user press "esc" key&lt;/li&gt;
&lt;li&gt;Automatic scroll &lt;/li&gt;
&lt;li&gt;Keep stacking context (dialog over dialog)&lt;/li&gt;
&lt;li&gt;Includes a &lt;code&gt;::backdrop&lt;/code&gt; pseudo-element for behind the element&lt;/li&gt;
&lt;/ul&gt;

&lt;h2&gt;
  
  
  Browser compatibility
&lt;/h2&gt;

&lt;p&gt;Dialog element has 93% of browsers' compatibility, in other words, it is considered full support!&lt;/p&gt;

&lt;p&gt;Visit the references &lt;a href="https://caniuse.com/dialog" rel="noopener noreferrer"&gt;Can I Use&lt;/a&gt; and &lt;a href="https://developer.mozilla.org/en-US/docs/Web/HTML/Element/dialog#browser_compatibility" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt; for more details.&lt;/p&gt;

&lt;h2&gt;
  
  
  Demo code
&lt;/h2&gt;

&lt;p&gt;I created a simple Demo code that show Dialog element in action and print as the result of user interaction the names of events handled.&lt;/p&gt;

&lt;p&gt;Feel free to explore the code 👇🏻&lt;/p&gt;

&lt;p&gt;&lt;a href="https://codepen.io/lucasm/pen/YzRBzVQ" rel="noopener noreferrer"&gt;https://codepen.io/lucasm/pen/YzRBzVQ&lt;/a&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Explanation
&lt;/h2&gt;

&lt;p&gt;1) In HTML, you need to create a &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt; element and attribute an ID to manipulate it&lt;/p&gt;

&lt;p&gt;2) Also create an &lt;code&gt;&amp;lt;button&amp;gt;&lt;/code&gt; to open the dialog (call event &lt;code&gt;open&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;3) Inside the dialog, place any content you want but don't forget to include the action buttons, usually one to confirm the main action and another to close dialog (call event &lt;code&gt;close&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;4) In CSS, you can style elements&lt;/p&gt;

&lt;p&gt;5) In JavaScript, all logic to handle events&lt;/p&gt;

&lt;p&gt;6) A event listener was also placed for when the user press the ESC key! (call event &lt;code&gt;cancel&lt;/code&gt;)&lt;/p&gt;

&lt;p&gt;That's all Web friends!&lt;/p&gt;




&lt;p&gt;I hope you enjoy it!&lt;/p&gt;

&lt;p&gt;What are your thoughts on the &lt;code&gt;&amp;lt;dialog&amp;gt;&lt;/code&gt; element of HTML? ✨&lt;/p&gt;

</description>
      <category>html</category>
      <category>javascript</category>
      <category>tutorial</category>
      <category>web</category>
    </item>
    <item>
      <title>Web Share API: how to use device native share</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Thu, 30 Jun 2022 23:13:14 +0000</pubDate>
      <link>https://dev.to/lucasm/web-share-api-how-to-use-the-device-native-share-548b</link>
      <guid>https://dev.to/lucasm/web-share-api-how-to-use-the-device-native-share-548b</guid>
      <description>&lt;p&gt;Hey Dev,&lt;/p&gt;

&lt;p&gt;Did you know that Web apps can also use the system provided share UI, as native apps do?&lt;/p&gt;

&lt;p&gt;Yes, you can! Using the &lt;code&gt;navigator.share()&lt;/code&gt; method of the &lt;strong&gt;Web Share API&lt;/strong&gt; in any Web application.&lt;/p&gt;

&lt;p&gt;Let's see how!&lt;/p&gt;

&lt;h2&gt;
  
  
  Code
&lt;/h2&gt;



&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;var btn = document.getElementById("webshareapiButton");

btn.addEventListener("click", function () {
  navigator.share({
    url: document.URL,
    title: document.title,
    text: "Lorem ipsum..."
  });
});
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;It's very simple! But have some requirements to works...&lt;/p&gt;




&lt;h2&gt;
  
  
  Requirements
&lt;/h2&gt;

&lt;ul&gt;
&lt;li&gt;Works only on websites running over &lt;strong&gt;HTTPS&lt;/strong&gt;. But works on local development (localhost) for tests.&lt;/li&gt;
&lt;li&gt;Works only in response to some &lt;strong&gt;user action&lt;/strong&gt; (such as a "click" event). To prevent abuses.&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  Demo
&lt;/h2&gt;

&lt;p&gt;I made a simple demo code comparing common social media share buttons (links based) and a button calling Web Share API.&lt;/p&gt;

&lt;p&gt;Note that some Desktops devices (like Windows, Linux and macOS) have no native share UI. Please, try to click on the button bellow using your Mobile device, to view the native share UI.&lt;/p&gt;

&lt;p&gt;&lt;iframe height="600" src="https://codepen.io/lucasm/embed/GYBmoR?height=600&amp;amp;default-tab=result&amp;amp;embed-version=2"&gt;
&lt;/iframe&gt;
&lt;/p&gt;

&lt;p&gt;Don't forget to include a fallback logic to unsupported devices, like this:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (navigator.share) {
  // Web Share API is supported, include code here
} else {
  // fallback code
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;h2&gt;
  
  
  Conclusion
&lt;/h2&gt;

&lt;p&gt;Now you know how to use &lt;strong&gt;Web Share API&lt;/strong&gt; on any Web application.&lt;/p&gt;

&lt;p&gt;To know more details about the Web Share API, like the current Browsers compatibility, see the links bellow.&lt;/p&gt;

&lt;h3&gt;
  
  
  References
&lt;/h3&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://developer.mozilla.org/en-US/docs/Web/API/Navigator/share" rel="noopener noreferrer"&gt;MDN Web Docs&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://web.dev/i18n/en/web-share/" rel="noopener noreferrer"&gt;Web.dev&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://css-tricks.com/how-to-use-the-web-share-api/" rel="noopener noreferrer"&gt;CSS-Tricks&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I hope you enjoy it!&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/lucasmezs" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;br&gt;
Sponsor my open source projects on &lt;a href="https://github.com/sponsors/lucasm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>javascript</category>
      <category>web</category>
      <category>share</category>
      <category>native</category>
    </item>
    <item>
      <title>Next.js: how to access browser "window" object</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Fri, 06 Aug 2021 20:07:30 +0000</pubDate>
      <link>https://dev.to/lucasm/how-to-access-window-object-in-next-js-5783</link>
      <guid>https://dev.to/lucasm/how-to-access-window-object-in-next-js-5783</guid>
      <description>&lt;p&gt;If you are trying to access "window" object from HTML DOM in your Next.js app and have this error message:&lt;/p&gt;

&lt;p&gt;&lt;code&gt;Unhandled Rejection (ReferenceError): window is not defined&lt;/code&gt;&lt;/p&gt;

&lt;p&gt;Just keep you code as the example:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;componentDidMount() {
   console.log('window.innerHeight', window.innerHeight);
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Another solution to just execute your code during rendering on the client side only, is:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;if (typeof window !== "undefined") {
   var width = window.innerWidth;     
}
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;






&lt;p&gt;I hope you enjoy it!&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/lucasmezs" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;br&gt;
Sponsor my open source projects on &lt;a href="https://github.com/sponsors/lucasm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>nextjs</category>
      <category>javascript</category>
      <category>dom</category>
    </item>
    <item>
      <title>A privacy guide for the data tracking era</title>
      <dc:creator>Lucas Maués</dc:creator>
      <pubDate>Thu, 11 Mar 2021 18:04:46 +0000</pubDate>
      <link>https://dev.to/lucasm/get-control-back-a-privacy-guide-on-the-data-tracking-era-2l96</link>
      <guid>https://dev.to/lucasm/get-control-back-a-privacy-guide-on-the-data-tracking-era-2l96</guid>
      <description>&lt;p&gt;You are here.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Your data is out there.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;You are valuable.&lt;/p&gt;

&lt;p&gt;Your personal data are being tracked and stored right now, to create psychological patterns and consumer interests datasets, to sell that information to third parties, and to finally create products and services based on what you — and thousands of people like you — 'wants'.&lt;/p&gt;

&lt;p&gt;We are bombarded by attempts to change our behavior, from the social media feed recommendations to the targeted ads over the internet.&lt;/p&gt;

&lt;p&gt;And that's ok. We accept all of this on the "terms of use" and "privacy policies" of all this services.&lt;/p&gt;

&lt;p&gt;But, unfortunately, this can be used against us and without our explicit consent, as the cases NSA/Snowden with Big Techs (2013), Cambridge Analytica with Trump (2019) and common data breaches show.&lt;/p&gt;

&lt;p&gt;And I didn't even mention the risks of real government surveillance in some countries and that citizens of an entire democracy can be manipulated.&lt;/p&gt;

&lt;p&gt;It's not the data that's exploiters, it's the people.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;Technology is good when used well.&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;This is a guide on how to get control back.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;1. Web Browser and Search Engine&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;All starts when you open your browser and search on the Web.&lt;/p&gt;

&lt;p&gt;But if the company behind them sells advertising? Well, every step your do is tracked and your data collected for third-parties.&lt;/p&gt;

&lt;p&gt;You can switch. Use a browser and search engine that respect your privacy by default.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://duckduckgo.com/" rel="noopener noreferrer"&gt;DuckDuckGo&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://mozilla.org/firefox/" rel="noopener noreferrer"&gt;Firefox&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://brave.com/" rel="noopener noreferrer"&gt;Brave&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://torproject.org/" rel="noopener noreferrer"&gt;Tor Browser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;2. Cookies, Ads and Trackers&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Everywhere.&lt;/p&gt;

&lt;p&gt;Cookies are good for personalized browsing experiences, and you can chose to able or disable.&lt;/p&gt;

&lt;p&gt;But targeted ads everywhere? There is no control. To do this, web trackers scripts are running 24/7 to collect your data to segment specific ads to you. Some of they are used to create a unique “fingerprint” to personally identify you based on your combinated browser and device info, or even, in worse ads cases, to difuse malware.&lt;/p&gt;

&lt;p&gt;Just block them with a browser extension — and when your visit the content sites, like DEV, put them in the whitelist.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://github.com/gorhill/uBlock" rel="noopener noreferrer"&gt;uBlock Origin&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://amiunique.org/" rel="noopener noreferrer"&gt;AmIUnique&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;3. Network, DNS and VPN&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Your Internet Service Provider (ISP), or anyone else listening your Internet connection, can see every site you visit and every app you use — even if their content is encrypted.&lt;/p&gt;

&lt;p&gt;Creepily, some providers sell this data (about your internet activity) or use it to target ads for you, or even, manipulate traffic priority and violate the net neutrality principle.&lt;/p&gt;

&lt;p&gt;You can try solve this using an more secure alternative for DNS (Domain Name System) resolver. You can also use a VPN (Virtual Private Network) to mask your IP address and protect your traffic from external monitoring.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://1.1.1.1/dns/" rel="noopener noreferrer"&gt;1.1.1.1 DNS&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.gethotspotshield.com/free-vpn/" rel="noopener noreferrer"&gt;Hotspot Shield VPN&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mozilla.org/en-US/products/vpn/" rel="noopener noreferrer"&gt;Mozilla VPN&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;4. Passwords and Account Data&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You can use browser default password manager or another to generate and store your passwords securely. When possible, apply two-factor authentication (2FA).&lt;/p&gt;

&lt;p&gt;But your password is not safe if it can be easily brute-forced right? Or already been compromised (found in a leaked database of passwords)? And what if some of your accounts are collecting more personal data than you expect? Having trouble deleting your account from a service?&lt;/p&gt;

&lt;p&gt;You can check all of these.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://password.kaspersky.com/" rel="noopener noreferrer"&gt;Kaspersky Password Check&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://haveibeenpwned.com/" rel="noopener noreferrer"&gt;Have I Been Pwned?&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://myaccount.google.com/data-and-personalization" rel="noopener noreferrer"&gt;Google Account Data and Personalization&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://account.microsoft.com/privacy/" rel="noopener noreferrer"&gt;Microsoft Account Privacy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://privacy.apple.com/" rel="noopener noreferrer"&gt;Apple Account Data and Privacy&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://justdeleteme.xyz/" rel="noopener noreferrer"&gt;JustDeleteMe&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;5. Social Media&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Social networks are amazing to keep in touch with our friends and family.&lt;/p&gt;

&lt;p&gt;But, remember, its "business model" is to encourage unnecessary and even dangerous exposure of our lives, in addition to collecting all our habits and tastes, outlining our profile and suggesting changes in our behavior with targeted advertisements.&lt;/p&gt;

&lt;p&gt;Take a time to review your social privacy settings.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://www.facebook.com/privacy/checkup/" rel="noopener noreferrer"&gt;Facebook Privacy Checkup&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://twitter.com/settings/safety" rel="noopener noreferrer"&gt;Twitter Privacy and Security&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.mozilla.org/firefox/facebookcontainer/" rel="noopener noreferrer"&gt;Mozilla Facebook Container&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;6. Chat and Email&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;If your need a secure chat app (that do not track your contacts) and a private-encrypted email service (that do not read your emails to sell ads), try:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://signal.org/" rel="noopener noreferrer"&gt;Signal&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://protonmail.com/" rel="noopener noreferrer"&gt;ProtonMail&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;7. Files and Metadata&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;You probably use a cloud storage service, and that's good, especially if have encryption capabilities.&lt;/p&gt;

&lt;p&gt;However, sometimes you want to temporary share files with privacy, and your can't.&lt;/p&gt;

&lt;p&gt;When you share photos on social media or files over the Internet, you ends up exposing himself sending metadata that identifies you, like timestamp, GPS location and device type info.&lt;/p&gt;

&lt;p&gt;You can get around it.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://upload.disroot.org/" rel="noopener noreferrer"&gt;Lufi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://datash.co/" rel="noopener noreferrer"&gt;Datash&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://file.io/" rel="noopener noreferrer"&gt;file.oi&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://metadata2go.com/" rel="noopener noreferrer"&gt;Metadata2Go&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;8. Apps Permissions&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Your activity history, personal files, location, camera, microphone, inking and typing can be tracked by OS and apps.&lt;/p&gt;

&lt;p&gt;It's strongly recommended that you check the “privacy” section in your OS settings, to disable not necessary running apps in the background and enforce restrictions to OS and apps permissions, both in your desktop/laptop and mobile phone.&lt;/p&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;9. Use an Open Source OS&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;"Enable automatic updates to keep your operating system secure and up to date". Yes! But...&lt;/p&gt;

&lt;p&gt;Even though Microsoft Windows and Apple macOS are really good OS, they are a 'billion dollar business' and track your behaviour for this reason.&lt;/p&gt;

&lt;p&gt;If you want privacy, more security and even control over your settings, you can choose a free and open source Linux-based distribution to use on your computer.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://librehunt.org/" rel="noopener noreferrer"&gt;LibreHunt&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://beta.distrochooser.de/" rel="noopener noreferrer"&gt;Distrochooser&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;h2&gt;
  
  
  &lt;strong&gt;10. Stay Updated&lt;/strong&gt;
&lt;/h2&gt;

&lt;p&gt;Read about the laws of data privacy of your country. What the legislators are doing about, and who is them?&lt;/p&gt;

&lt;p&gt;Did you know that organizations are fighting for a better and secure internet? And you can contribute.&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;&lt;a href="https://unctad.org/page/data-protection-and-privacy-legislation-worldwide" rel="noopener noreferrer"&gt;Data Protection and Privacy Legislation Worldwide - United Nations&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://rankingdigitalrights.org/index2020/" rel="noopener noreferrer"&gt;Corporate Accountability Index - Ranking Digital Rights&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://2020.internethealthreport.org/" rel="noopener noreferrer"&gt;Internet Health Report - Mozilla Foundation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://www.eff.org/issues/privacy" rel="noopener noreferrer"&gt;Privacy Issue - Electronic Frontier Foundation&lt;/a&gt;&lt;/li&gt;
&lt;li&gt;&lt;a href="https://humanetech.com/" rel="noopener noreferrer"&gt;Center for Humane Technology&lt;/a&gt;&lt;/li&gt;
&lt;/ul&gt;




&lt;p&gt;I hope you enjoyed!&lt;/p&gt;

&lt;p&gt;Do not feel pressured to use any of these suggestions.&lt;/p&gt;

&lt;p&gt;Just the fact that you read this far means that you learned something about the importance of your privacy today.&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Privacy is a right, not a choice.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;Do you have other privacy tip? Share on the comments =)&lt;/p&gt;

&lt;p&gt;Follow me on &lt;a href="https://twitter.com/lucasmezs" rel="noopener noreferrer"&gt;Twitter&lt;/a&gt;&lt;br&gt;
Sponsor my open source projects on &lt;a href="https://github.com/sponsors/lucasm" rel="noopener noreferrer"&gt;GitHub&lt;/a&gt;&lt;/p&gt;

</description>
      <category>privacy</category>
      <category>tracking</category>
      <category>security</category>
    </item>
  </channel>
</rss>
