teleren/devto huggingface dataset:
The Difference Between React Server Components and Server Side Rendering (SSR)
Tags: react, javascript, webdev, programming
Published: 2020-12-23 10:36:05

---
title: The Difference Between React Server Components and Server Side Rendering (SSR)
published: true
description: In December 2020, the React team introduced an experimental feature called React Server Components. This may leave you wondering how exactly these "server components" differ from Server Side Rendering (SSR).
tags: react, javascript, webdev, programming
cover_image: https://dev-to-uploads.s3.amazonaws.com/i/m96iybm3t5e4vfym96bz.png
canonical_url: https://typeofnan.dev/what-is-the-difference-between-ssr-and-react-server-components/
---

In December 2020, the React team introduced an experimental feature called React Server Components. This may leave you wondering how exactly these "server components" differ from Server Side Rendering (SSR).

<hr />

### If you enjoy this post, please give it a 💓, 🦄, or 🔖 and consider signing up for 📬 [my free weekly dev newsletter](https://buttondown.email/devtuts)

<hr />

# SSR Is All About the Initial Page Load

When you're using SSR, you are sending HTML to the client and then loading up all your typical React JavaScript. The application is considered _hydrated_ once the JavaScript is loaded and the app is back to being a functional client-side React app. This means that, after the initial page load, your app is essentially the same old React app that you'd have if you _weren't_ using SSR. In SSR, all of your components are still client components outside of the fact that your first page load was pure HTML!

TL;DR: SSR is basically all about that initial load seeming more like a traditional server-rendered app.

# React Server Components Are Always Rendered on the Server

React Server Components are always rendered on the server. These are likely components that are fetching some data from your backend, so it makes sense to have the rendering of these components colocated with the data that's being fetched. Whenever these components need to be rerendered, they are refetched from the server and merged into the existing, client-side React component tree. What's cool about this is client state is _preserved_ even though we're refetching parts of the view from the server.

# React Server Components Are More Likely to Reduce Bundle Size

Since SSR apps are about the initial page load, the client is likely to end up downloading all your dependencies as they explore your application (after all, it's a client side app after that first page load). However, if you have dependencies for a React Server Component, those dependencies will _always_ be only on the server since those React Server Components are not shipped to the front-end until they have been rendered.

# Conclusion

While React Server Components and SSR both involve some React rendering on the server, they're actually quite different! RSCs are a very interesting development and I certainly look forward to learning more about them.
Unable to pass access_token to endpoint in Reactjs
Tags: react, javascript
Published: 2020-12-23 10:25:50

I am trying to fetch data from an API which requires `access_token`. There is another API for fetching `access_token`. So, I am first trying to fetch acess_token and then pass it to the API which returns data. 

I observed that the token API is getting hit but by the time it is passed to the data API, token is `undefined`

[![enter image description here][1]][1]

**Here is my code**

    const useFetch = (url, headers) => {
        const [data, setData] = useState([]);
        const [loading, setLoading] = useState(true);
          useEffect(async () => {
            const response = await fetch(url, headers)
            const data = await response.json()
            console.log(data)
            setData(data)
            setLoading(false)
          },[]);
          return {data, loading};
      }
    export default function CreateTestcaseStep2() {
        var access_token_headers={
            method : 'POST',
            headers: {
              'Accept': 'application/json',
              'Content-Type': 'application/x-www-form-urlencoded'
            },
            body : 'grant_type=something&client_id=something-test&client_secret=something&scope=something'
          }
        const {token, loading_token} = useFetch('ACCESS_TOKEN_API', access_token_headers)
        console.log("token is ", token) // TOKEN IS PRINTED AS UNDEFINED HERE
        var api_headers={ method: 'GET',
          headers: {'Authorization': `Bearer ${token.access_token}`},
        }
        const {data, loading} = useFetch('DATA_API', api_headers)
    }
      


  [1]: https://i.stack.imgur.com/tNPIj.png

**Please suggest how to get access_token first and then pass it to data_api.**
SHOPPING SITE DONE WITH VUEJS AND FIREBASE 
Tags: vue, firebase
Published: 2020-12-23 10:19:38

Hey guys, this is my first post here on dev. I built a fully functional shopping site with vue, vuex and Firebase as backend. It's features include user authentication, Firebase rtdb to save the shopping cart.
The link to the site is https://natural-home-of-remedies.web.app

It's a basic site though... Please if you encounter any errors.. Please do let me know.. Thanks🙏🙏
TypeWritter Effect - Vanilla JS
Tags: javascript, animation, webdev
Published: 2020-12-23 10:16:31

# TypeWritter Effect - Vanilla JS

{% codepen https://codepen.io/nilroy/pen/JjXmjmZ %}

There comes a time when you want to do something cool like a typewriter on a web page. There are multiple ways to accomplish it, but today let me show you the vanilla JS way!

## The Algorithm
First, we have to initialize a list of strings that we want to type and erase in a loop. The idea is to start from the first character of the first line. We keep adding characters, till we reach the end. Note that we have added `+ 5` here to stall for a few more cycles before we start erasing. Then we start removing characters, this time 2 at a time! This creates an effect of slow typing and fast erase. Once we reach the beginning of the string, we reset the direction and move on to the next item in the array. Finally, once we reach the end, we start over from the first item in the array.

## Performance
I switched to the performance tab and recorded the run for about 10 seconds. The scripting time is approximately 0.002%.

![image.png](https://cdn.hashnode.com/res/hashnode/image/upload/v1607060865132/v8THZayNw.png)

## Advantage over CSS
I have seen some CSS based solutions, but they have a dependency on the number of characters and work for only one string. This allows you to work with multiple strings in a loop and independent of the string length. If you want to tinker with the speed, just change the timeout value.

---
Love what you see? Follow me or subscribe to the newsletter to stay updated when I post more cool stuff!

---
Originally published at [https://ones-zeros.royniladri.dev/typewritter-effect-vanilla-js](https://ones-zeros.royniladri.dev/typewritter-effect-vanilla-js)
<a href="https://www.buymeacoffee.com/royniladri" target="_blank"><img src="https://cdn.buymeacoffee.com/buttons/v2/default-blue.png" alt="Buy Me A Coffee" width="170"></a>
Covtact: New name and design [DO-Hackathon]
Tags: dohackathon, design, domain, covid19
Published: 2020-12-23 10:11:01

---
description: Build a contact diary / logging app for the DigitalOcean Hackathon: Add a new domain to DigitalOcean
---

## Project recap
During the DigitalOcean Hackathon 👨‍💻 I want to build an app which allows you to log with whom you had contact. This is so you can inform people if need be and stop further COVID-19 spreading.

As mentioned in the last post there is already a working Proof of Concept, hosted on DigitalOcean’s App platform, available: [Covtact](https://covtact.app). 

## Naming

I decided to go with the singular name: Covtact. in case you didn't notice, it's a word combination on Covid and Contact...

Also, to give this project a proper home, I purchased a brand new domain: [covtact.app](https://covtact.app). Feel free to share this around, this is where it will stay. (In case you get an error, the DNS might take a little while).

I added the domain to DigitalOcean and am using their DNS nameservers. It took some minute to become active, and after some more time all my clients updated their entries as well. Well, that's how it is, I guess.

And, drumroll 🥁, I implemented the new UI I hinted at in the last post! Tell me if you like it, there are some things to improve for sure...

## Feedback?

There’s still work to be done, but the app is already useable. Try it out, [log your contacts](https://covtact.app) if you had any and help stop this pandemic. [Hint: It might become extra important during the holidays, please stay responsible in your actions]. 🙏

As always, tell me what you think about this project down in the comments, or let‘s connect on [twitter](https://twitter.com/kriswep)!
Unresolved compilation problem (with no explanation?).
Tags: java, help, gamedev
Published: 2020-12-23 10:03:33

So, I'm making RuntDeale, and I tried compiling a test I made, it compiled with no (visually displayed (as they WOULD be, if there were any)) errors, and it creates the `.jar` file, but when I double click it, it doesn't run (or rather, does not do what it's supposed to do (which is to create a window with the title "`RuntDeale`", that has a black background, and is NOT resizable)).

So, I try running tests where I know how to test best, VSCode, and, this time, I do see an error. Specifically:
```
Exception in thread "main" java.lang.Error: Unresolved compilation problem: 
        at RuntDeale.code.Main.main(Main.java:44)
```
`Main.main(String[] args)` looks like this:
```java
public static void main(String[] args) {
	Main program = new Main();
	try {
		program.run();
	} catch(Exception exc) {
		program.setTitle("Exception: "+exc.getLocalizedMessage());
	}
}
```
<br/>
I only really have one theory, that it (for some reason) can not resolve the class `RuntDeale.code.Backpack` (which is just meant to be something to help me save time, so I don't have to rewrite code).
If any additional information is needed, please ask, but please, tell me what you think the problem is.
<div>
##<b><center><b>Thanks<br/>Cheers!</b></center></b>
</div>
Ness deploys web sites and apps to your cloud account
Tags: webdev, aws, cloud, tooling
Published: 2020-12-23 09:59:52

Introducing Ness—the easiest way to deploy web sites and apps into your AWS account. I built Ness to simplify the process of shipping web products in a repeatable way with all of the best practices around security and performance baked into a single command.

```
npx ness deploy
```

As a software engineer and maker, I rely on AWS every day to help bring my ideas to life. A year ago, I discovered the [AWS CDK](https://aws.amazon.com/cdk/) and it dramatically improved my ability to stand up infrastructure quickly. I noticed, however, that I was often creating the same handful of resources (or "components" in CDK terms) each time I wanted to deploy a web product: an S3 bucket, a CloudFront distribution, a Route53 hosted zone and aliases, etc. The CDK makes it easy to componentize these resources, but standing up a CDK app for a simple static landing page felt tedious.

### Doesn't Amplify do this?

In short, yes. But, Amplify does _[a lot](https://aws.amazon.com/amplify/features/)_ more. Ness is narrowly focused on deploying web assets to S3 and serving them through CloudFront with sane defaults that follow best practices. This means that the Ness CLI experience is straightforward and extremely simple to use. Amplify, on the other hand, has many additional concerns as it's a much richer product aimed at standing up a variety of supporting resources such as data stores, APIs, and more.

Amplify also has a product surface area that stretches into the AWS console, which can mean that you need to open a browser to complete some web deployment and configuration tasks. This isn't inherently good or bad; it just represents a different philosophy and highlights Amplify's much larger (and more complicated) footprint.

### Netlify and Vercel definitely do this...

Netlify and Vercel also offer CLI commands to deploy to the web with minimal friction, with one important difference: they're paid products and you'll eventually pay a premium over the AWS costs you're accruing if you scale out of their respective free tiers. For many small projects, costs likely won't come into play; but, you also lose a bit of control if you're someone that enjoys managing AWS accounts.

It's worth noting that today Netlify and Vercel have several important features that Ness is lacking—namely preview environments and (lambda) functions. The plan is to add these features (and more) to bring Ness into parity with these commercial products and represent a free, open-source alternative for those that don't mind—or even prefer—to own their own infrastructure.

### Next Steps

Next, I plan to add preview environments for new pull requests on GitHub through an official GitHub Action. I'd love to hear if others are finding this tool useful and what features they'd like to see moving forward. Find me on [Twitter](https://twitter.com/aeduhm) and/or [GitHub](https://github.com/nessjs/ness) (pull requests are welcome!).
How to find a child (not direct child) of a specific element by Id(parent Id)?
Tags: javascript
Published: 2020-12-23 09:44:18

Hello , 

````
<parent id="abc-1">

  <child-1>
    <child-2></child-2>
    	<child-3>
    		<child-4 class="my-class">Hey my data</child-4>
	</child-3>
   </child-1>

  <child-5></child-5>

</parent>
````

I would like to get the content of the element where the class name is `my-class`

This element exists inside `parent` with the id="abc-1" but we don't know on which level, maybe child or child of child or ... but we are sure that the class name is `my-class`
On the topic of death
Tags: watercooler
Published: 2020-12-23 05:48:41

Recently, I noticed that I have more grey hair than I expected, and then I realized I'm turning old. I have this mid-life crisis of life's goals and values. I haven't reached most of the goals I set out, and the thought of missing out on new things that will happen in the far future saddens me. You know, the space travel, the exploration of new horizons, the meetings with aliens perhaps,... I will never ever see that.

I'm not a religious person. I have always been pondering what will happen after death. Will it be the end of everything, or will there be some continuation after death? Whatever it will be, I'm pretty sure that the "me" that exists now will cease its existence completely. Death is a fascinating topic and I have read and watched lots of documents on it.

It's not all grim, however. When I look at my children, still of a very young age, I see a glimpse of hope. Through them, I see a continuation of life. Some day, my grand grand daughter may ride her own spaceship out of the Solar system during her day trip. Some day, we the human may even find the fountain of youth that death seems like a strange concept to us all. Imagine the possibilities when you can live for centuries. Oh the things you can learn, the places you can see, the stuffs you can do.
AI IN BUSINESS
Published: 2020-12-23 09:23:45

Artificial intelligence is already widely used in business applications, including automation, data analytics, and natural language processing. Across industries, these three fields of AI are streamlining operations and improving efficiencies.

Automation alleviates repetitive or even dangerous tasks. Data analytics provides businesses with insights never before possible. Natural language processing allows for intelligent search engines, helpful chatbots, and better accessibility for people who are visually impaired.

Other areas where we can expect to see significant AI-based advancements include the healthcare industry and data transparency and security.

For some industries, the widespread rollout of AI hinges on ethical considerations to ensure public safety.
The responsible SEO experts to take care of your SEO needs
Published: 2020-12-23 09:11:40

There is high competition prevailing in the marketing world. So, the right digital marketing strategy will be the only way to boost your online business. If you want the recognition and brand visibility to a higher position while keeping the competitors behind you, it is worth considering best SEO experts in India. Having the assistance of SEO experts can help you with social media marketing, mobile marketing, conversion rate optimization, etc. Being a renowned digital marketing company, the SEO experts’ team ensures Search Engine Optimization and search engine marketing is the best way. We are specialized in high-end PPC advertising, application store optimization, web analytics, online reputation management, affiliate marketing, and content marketing. The right web development company excels in all its marketing strategies and ensures lead generation. Thus, you can be assured of maximized profit in the long-run. Besides, the tools our best SEO experts in USA utilize to analyze and improve the website’s effectiveness make our service outstanding. We understand that pay per click advertising is the best way for targeting a qualified audience. That said, we can properly create the plans that can be custom PPC campaigns for helping you increase the conversion as well as revenue for the company. We can work with Google and Bing AdWords. With us, these plans come in different setups. We are the one-stop solution for all your marketing needs. We are here to assist you with everything from tracking the user’s responses to molding your business to be identifiable as a brand. If you are looking for proper boost-up and assistance to grow on the internet, our services are worthy of consideration from all aspects. 

<a href="https://thebestseoexperts.com">Best SEO Experts in India</a> | <a href="https://thebestseoexperts.com">SEO Company in India</a> | <a href="https://thebestseoexperts.com">Best SEO Experts in USA</a>
JavaScriptmas - 24 Days of Javascript Fun 🎄
Tags: javascript, challenge
Published: 2020-12-23 09:10:35

![Alt Text](https://dev-to-uploads.s3.amazonaws.com/i/9magvrejiwewun155czu.jpg)

Who doesn’t like advent calendars? I think everybody does, mainly because everyday a new present is received and you never know what to expect! But what about an advent calendar where everyday you get a new JavasScript challenge? That sounded like fun to me, so that’s the reason I embraced this journey, on [Scrimba](https://scrimba.com/learn/adventcalendar).

Although some of them seemed simple, I did learn new things and it felt really great when I managed to resolve them quickly and on my own. I spent some time designing and uploading them on my Github page and overall it was a very productive experience for me.

I’ve added below the solutions I came up for the JavaScriptmas Challenge and also the repo on my Github page:

Day 1: [Solution](https://scrimba.com/scrim/co4ff470e96cfec7d95bfef6e)
Day 2: [Solution](https://scrimba.com/scrim/co6e647ff8c72349be11291c4)
Day 3: [Solution](https://scrimba.com/scrim/co42546d4a45f5e1237720686)
Day 4: [Solution](https://scrimba.com/scrim/coae04a54b24183586745988f)
Day 5: [Solution](https://scrimba.com/scrim/coe474e3d945a167bc318fbf7)
Day 6: [Solution](https://scrimba.com/scrim/co6f24428ae7af06d80f35cda)
Day 7: [Solution](https://scrimba.com/scrim/co4224e3caf9d19e034650f8e)
Day 8: [Solution](https://scrimba.com/scrim/co3f94b2d8ca6892e4f71eafe)
Day 9: [Solution](https://scrimba.com/scrim/co2cb4f999384a2581f3eef71)
Day 10: [Solution](https://scrimba.com/scrim/co9da4fd7b65b8d1a364da268)
Day 11: [Solution](https://scrimba.com/scrim/co81a4fc8bcb22a66cf8db720)
Day 12: [Solution](https://scrimba.com/scrim/cob604a48aa2ed0b5e28676b1)
Day 13: [Solution](https://scrimba.com/scrim/cob3c449a83cac543b7f6f0ad) 
Day 14: [Solution](https://scrimba.com/scrim/co0914f42bf2ecbafbc0e96f6)
Day 15: [Solution](https://scrimba.com/scrim/co0f146f983f5c6110cc8ce69)
Day 16: [Solution](https://scrimba.com/scrim/coeaf493cb072190e098a9b9d)
Day 17: [Solution](https://scrimba.com/scrim/co47c410094da3e5611ac4c20)
Day 18: [Solution](https://scrimba.com/scrim/co92d4c97a2713d88b4124ea9)
Day 19: [Solution](https://scrimba.com/scrim/co9424999a3ff2199211a8520) 
Day 20: [Solution](https://scrimba.com/scrim/co43246a49b95069b98e136c6)
Day 21: [Solution](https://scrimba.com/scrim/co1364e0f94db4db5e34e3619)
Day 22: [Solution](https://scrimba.com/scrim/coc2745e7942bd51962840700)
Day 23: [Solution](https://scrimba.com/scrim/coe99492f839df7b627d8b60a)
Day 24: [Solution](https://scrimba.com/scrim/co4c2461fb2667c0db7860da6)

The challenges are also uploaded on Github: 
{% github narcisabadea/24-days-of-JavaScriptmas%}

Please feel free to add any suggestions.

Thanks for reading 🎄
Python tips: playing with round()
Tags: python, round
Published: 2020-12-23 09:06:13

You have probably already worked with the Python built-in `round()` function. It takes a number as an argument and simply rounds it. But depending on its second parameter, the function can actually perform a range of rounding calculations with different types of precision. As you'll see later, you can even pass negative numbers as parameters.

To begin with, `round()` can simply take one value as a required argument to perform a standard rounding operation:

```shell
>>> round(1.2489)  # <- returns the nearest integer
1
>>> round(1.5)
2
>>> round(2.5)
2
```

If rounding both 1.5 and 2.5 to 2 is not precise enough for you, `round()` accepts the second parameter to represent the number of digits from the decimal point you wish your number to be rounded to. Just like that:

```shell
>>> num = 1.28372
>>> round(num, 1)
1.3
>>> round(num, 2)
1.28
>>> round(num, 3)
1.284
```

We can now round the numbers from the chunk of code above more precisely:

```shell
>>> round(1.2489, 2)
1.25
>>> round(1.5, 2)
1.5
>>> round(2.5, 2)
2.5
```

The more interesting thing is that `round()` also accepts **negative numbers** as the second argument and, in this case, rounding takes place for tens, hundreds, thousands, and so on:

```shell
>>> num = 274895
>>> round(num, -1)
274900
>>> round(num, -2)
274900
>>> round(num, -5)
300000
```

And a bit more surprisingly:

```shell
>>> round(num, -6)
0
```

If you pass in a floating point value with a negative parameter, the function will return a float instead of an integer:

```shell
>>> num = 274895.56
>>> round(num, -1)
274900.0
>>> round(num, -2)
274900.0
```
Hope you enjoyed my post! If you did, don't forget to like it. Thank you :)
AI - Indian armed forces
Published: 2020-12-23 09:00:19

                   
Indian defence system is one of the weakest among many small countries since 2014. But after then when the government changed to BJP, our pm made many decisions and rules change and the budget spent just this year was approximately 67 billion dollars, happened never before in our history. 
In an effort to become a fully network-centric force, use of artificial intelligence (AI) will begin in the military in the near future, says a top Indian Army commander. According to Lt Gen Alok Kler South-Western Commander, “In the next three to four years, AI will be used in the military and the process has begun
The U.S. military is already integrating AI systems into combat via a spearhead initiative called Project Maven. Now India also developing such integrated  missile system through DRDO (Defence Research and Development Organization) ,our government spending 7 billion dollars on developing such missiles. 
The only supersonic cruise missile can reach 600kmph called brahmos was developed by our DRDO in this year and remodeled our su -30 fighter jets and loaded with these brahmos which can reach at max 500 km and now they are working to the extent of 800 km and also we received Dassault rafles the most powerful 5th generation fighter gets  which are equally powerful to f 35 stealth fighters.