🆕 Update on Flatlogic Web App Generator!

Hey coders! We hasten to share this month’s updates! We’ve added two useful features to the Web Application Generator. In case you haven’t heard… we’ve been hard at work over here launching a web app generator. It is the direct result of more than 7 years of our professional expertise in web development. So now, you can build an application and check the following things:

1) Code preview

Code preview allows you to check the structure of the code, all the folders inside and ensure that everything is going fine. Make sure that everything works fine before subscribing to the generator.

2) Application overview page

The application overview page includes the name of the application you’ve created, the stack you’ve chosen, and the URL.

Feel free to test it out, generate your demo project with Flatlogic web app builder.

In case you face any difficulties creating your app please leave a message on our forum. And share your honest feedback, we will be endlessly grateful for any of your comments.

The post 🆕 Update on Flatlogic Web App Generator! appeared first on Flatlogic Blog.

Flatlogic Admin Templates banner

335: Code’s a Drag

There are lots of types of dragging that can happen on websites. While they are all click (or tap), hold down, move, and let go, they are all quite a bit different. For instance:

Drag files/folders onto the browser window and drop them. The likely use case there is uploading.
Drag an element on the screen to another (valid) area of the screen. The likely use case is dragging cards from one column to another
Drag the position of an element. The likely use case is dividers between different areas.

There are native APIs for dragging stuff on the web, and it’s nice to use them when you can as that means not relying on potentially hefty JavaScript libraries. And yet, the native APIS are fairly limited, and the JavaScript libraries that exist for this stuff are pretty darn nice.

We use Filestack for file uploading. There are lots of incentives there, like them staying on top of the latest and greatest in browser tech around this stuff rather than us having to. Back when we switched to this, we got mobile uploading support overnight, for example. For drag-elements-to-other-areas we use react-beautiful-dnd, which is a pretty darn nice library for that, especially since we’re using React anyway. Interestingly, as robust as react-beautiful-dnd is, it doesn’t really support position-dragging at all. Just not what it’s built for. So for that, we’ve gone back to the trenches to write our own componentry, which is a delicate balance of JavaScript event-powered and CSS behind it that supports the changes.

Time Jumps

00:26 Dragging (on) CodePen

01:04 How the browser works with drag and drop

05:52 iFrame bugs with drag and drop

08:29 Sponsor: WordPress.com

09:02 Kanban style drag and drop in the browser

15:49 Triggering a drag event

23:56 Lack of support for dragging

28:12 Dealing with Grid

Sponsor: WordPress.com

WordPress.com is easily the fastest way to spin up a great-looking WordPress site. Not to mention performant and secure, as your site will be hosted on the great WordPress cloud, and they make those things their concern, not yours. You might think you’d have to give up a lot of control and customizability when you use a fully hosted and managed WordPress service (as opposed to hosting yourself), but that’s actually not true. If you’re on the Business Plan or higher, you can install plugins, SFTP into the server, and even have direct database access like any other host.

The post 335: Code’s a Drag appeared first on CodePen Blog.

React Chat App: How to Make a Chat Using Socket.io

Table of contents:

Introduction
What you need to know about React Chat Apps
Why your project needs its own React Chat App
How to Create Your Own React Chat App
Examples of Well-Made React Chat Apps
Conclusion

Introduction

We hope that you will find this article really helpful. And not only because we intend to talk about the theoretical side of React chat apps, their importance and usage, but also because we are going to discuss the practical creation of such apps with the help of Flatlogic’s own Full Stack Web Application Generator – an amazing new tool, aimed at easing the tiresome process of creating apps from scratch.

What You Need to Know About React Chat Apps

Let’s start with a traditional question: “What is a React Chat App?”. And the answer to this question is quite simple: a React chat app is an application, whose primary purpose is to provide customers and/or clients with an opportunity to communicate with project representatives to help them solve any issues they might have with the project. Moreover, chat apps allow you to keep in touch with your clients in other ways, like providing them with your project’s news, updates, and any other information you deem significant. Another quite important feature of chat apps is the possibility of digitally storing your clients’ data such as names, addresses, messages, etc. They can also be used within your project as a tool to centralize all the internal team communications and data.

Why Your Project Needs React Chat App

Such applications are in high demand nowadays, as due to the overall number of businesses and projects present on the market, the client-business paradigm (or demand-supply paradigm in the broader sense) tends to side more with the client. This means that it is more important for a modern business to create a harmonious relationship with a customer than vice versa, because their wishes and needs could be satisfied by a company’s competitor more easily than the other way round if a client has any dissatisfactions with the current company. Thus, maintaining a strong relationship between you and your client is becoming more and more important, and this includes providing live support. Businesses and projects that are unique and have no competitors or alternatives might not have such a problem in the short run, although we should stress that the problem is not only in the short run. The reason for this is the simple fact that it is always a matter of time before a unique product acquires competitors and alternatives. That is why sustaining good relationships is essential. Luckily, this goal can be easily accomplished via chat apps.

So, now, having shown you the need for a chat app for your current and future projects let’s set out why we advise you to create it in React. And, the short answer would be that chat apps based on React.JS are fast, scalable and easy to maintain for developers. Don’t get us wrong, there are other programming languages that are also up to the job, but we suggest, nonetheless, using ReactJS, as there is no need to choose a longer and windier road. And that’s not mention the fact that you and your developers can simplify even that task and use Flatlogic’s Full Stack Web Application Generator. And that brings us to our next topic.

How to Create Your Own React Chat App

In this part of the article, we will discuss two ways of creating React Chat Apps:

Writing its code from scratch;

Using Flatlogic’s Full Stack Web Application Generator.

Let’s start by looking at the first method. There are two major steps you have to undertake in this case, each having a number of substeps::

Creating and Coding the Backend;

Creating and Coding the Front-end;

In creating a React Chat App by this method, you will also secure all of the information and data in your Chat App with E2E Encryption. But let’s get more specific and look more closely.

Step 1. Creating and Coding the Backend

For the first part of this step, which is actually creating the backend, we use such tools as the Express framework and Node.js. We use them with the purpose of providing real-time, two-way communication between the backend server and the frontend.

The second part of this step, which is coding the backend, is divided into several substeps, the first of which is creating a server directory and its browser. The code would look as follows:

·   mkdir chatbackend

·  cd chatbackend

After that, the creation of the package.json is needed. To do that, insert the following piece of code into the terminal:

· npm init –y

This way you get package.json.

Then you should create separately:

touch dummyuser.js

Add to the dummyuser.js file:

const cusers = [];

function joinUser(id, username, room) {

const puser = { id, username, room };

cusers.push(puser);

console.log(cusers, “users”);

return p_user;

}

console.log(“user out”, cusers);

function getCurrentUser(id) {

return cusers.find((puser) => puser.id === id);

}

const index = cusers.findIndex((puser) => puser.id === id);

if (index !== -1) {

return cusers.splice(index, 1)[0];

}

}

module.exports = {

joinUser,

getCurrentUser,

userDisconnect,

};

touch server.js

Add to the server.js file:

const express = require(“express”);
const app = express();
const socket = require(“socket.io”);
const color = require(“colors”);
const cors = require(“cors”);
const { getCurrentUser, userDisconnect, joinUser } = require(“./dummyuser”);

app.use(express());

const port = 8000;

app.use(cors());

var server = app.listen(
port,
console.log(
`Server is running on the port no: ${(port)} `
.green
)
);

const io = socket(server);

io.on(“connection”, (socket) => {
socket.on(“joinRoom”, ({ username, roomname }) => {
const puser = joinUser(socket.id, username, roomname);
console.log(socket.id, “=id”);
socket.join(puser.room);

socket.emit(“message”, {
userId: puser.id,
username: puser.username,
text: `Welcome ${puser.username}`,
});

socket.broadcast.to(puser.room).emit(“message”, {
userId: puser.id,
username: puser.username,
text: `${puser.username} has joined the chat`,
});
});

socket.on(“chat”, (text) => {
const puser = getCurrentUser(socket.id);

io.to(puser.room).emit(“message”, {
userId: puser.id,
username: puser.username,
text: text,
});
});

socket.on(“disconnect”, () => {
const puser = userDisconnect(socket.id);

if (puser) {
io.to(puser.room).emit(“message”, {
userId: puser.id,
username: puser.username,
text: `${puser.username} has left the room`,
});
}
});
});

Now, onto substep #2, which is all about creating dependencies and providing coding needed for the user’s ability to be added to an empty room by creating an array of empty users. It also empties the array when the user disconnects.

To create dependencies, do as follows:

npm i socket.io express cors colors

npm i -D nodemon

Create ·   node_modules

Now, we get to substep number three. Its main purpose is to create a server file, which is used for backend connection initialization and users-room communication provision. In order to complete this substep, do as follows:

Now, you need to set the following listeners:

·   joinRoom. This one is needed to enable a new user to join the chatroom, as it provides a greeting message for the joining user as well as a notification about the user joining everybody else in the chatroom.

·   chat. This one is crucial, as it handles the actual process of sending and receiving messages. It also sends an informational message about the user leaving the chat, if such a situation occurs.

That finalizes our active work on the backend side of the chat app.

Step 2. Creating and Coding the Front-end

For this step we will use React, Redux library, the socket.io-client, as well as a tool, known as aes256, which helps in the above-mentioned encryption, and, for that matter, decryption of information and data, contained within the chat.

Our first substep in this case is Creating the Front-end, which is all nice and simple. The final folder structure of the Front-end should look this way:

· chartfrontend
> node_modules
> public
· src
§ chat
§ chat.js
§ chat.scss
· home
§ home.js
§ home.scss
· process
§ process.js
§ process.scss
· store
· action
§ index.js
· reducer
§ index.js
§ process.js
o _global.scss
o aes.js
o app.js
o app.scss
o index.js
{} package-lock.json
{} package.json

Our second step is Coding the front-end. This part of the process has quite a number of steps, and, as the front-end side of the coding process is more creative-based than the backend one, we will only describe the general order of the substeps, without giving you the particular lines of code.

So, substep number one would be creating a client folder for our React App, as well as installing the dependencies necessary for the app to actually run.

The second substep would be to:

§  make modifications in your /src/index.js file in order to help the implementation of reducers in the react app;

§  after that, the creation of a file /store/action/index.js, which is needed for the definition of action objects that allow us to avoid writing the object every time we need it;

§  the next thing you would need to do is to create the /store/reducer/process.js, which would act as the reducer in the app, meaning that it would take the current state of the new action objects and return them to their new states;

§  then, get down to the creation of the /store/reducer/index.js file in order to import the newly created reducers and call the previously created action object;

§  and, finally, add redux to your React App and create the process action.

All of these actions are needed to ensure the sending and receiving of the incoming and outcoming messages through the aes.js file, and, correspondingly, the encryption and decryption of the messages.

After all the above-mentioned substeps are completed, we come to substep number three, which is responsible for the creation of route fetches for the user and room names. After that add styling of your liking for App.js.

The fourth substep constitutes coding the /home/home.js file, which acts as the homepage of the app, where the users write down their usernames and room names that they would like to join. It is absolutely necessary to code in the socket.emit(“joinRoom”) function for the joinRoom function to be defined in the backend, and, subsequently, give users an opportunity to be added to the room and be greeted by the welcome message, which we have mentioned earlier. After that, add stylings of your choosing to the home.js file.

The next substep, which would be the fifth one, is coding the /chat/chat.js file, which loads as the user joins the room. Basically, this is the main page of the chat, where users can chat with each other using the chatbox. After that, add stylings of your choosing to the chat.js file.

Substep number six is the creation of the aes.js file that is our encryption/decryption messages.

After that, we come to the seventh substep, which is creating the /process/process.js file, responsible for the display of the secret key, as well as encrypted and decrypted message on the right side of the chat room. Then, add the stylings of your choosing to this file.

Finally, run the server and the app you’ve got to test the final app.

And that’s how you create a React Chat App, which is also empowered by the E2E encryption. And while this is a pretty quick and easy process, there is a way to make it even more effortless using Web Application Generator. It is more than just a useful tool, but the apogee of more than 7 years of Flatlogic’s combined expertise and professional knowledge in one exceptionally made package. It allows you to create fully functioning and ready-to-use apps with just three simple actions:

Choose your chat app’s stack: React, Vue and Angular as front-end versions, as well as, Node.js as a backend option and PostgreSQL/MySQL as database options;
Defining a database scheme;
Choose the stylings and design for your chat app.

Then you just press the “Generate app” button and watch the magic happen by itself. So, even though the process of creating a React Chat App is quite simple even of itself, we highly recommend creating your next project’s chat app using Full Stack Web Application Generator to make a stunningly effective application in a jiffy.

Examples of Well-Made React Chat Apps

And in this part of the article, we would like to share with you 5 examples of React Chat Apps that we find quite well made and explain why we think so.

Example №1 – simple chat window thing built in React by Joshua P. Larson

We consider this React Chat App to be well-made as it shows that it is not always necessary to have lots and lots of flashy features to be considered a good, reliable addition to your project. Slow and steady or, more appropriately to the occasion at hand, nice and simple, wins the race.

Source – codespots.com/library/item/3749

Example №2 – Chat Application by DanLowo

This one is a beautifully made and stylings-heavy React App, somewhat reminiscent of a better-made Instagram Direct Messages. We include it into the list of our examples as a way to convey the importance of making your chat app visually appealing to the final user. It also should be mentioned that Flatlogic’s Full Stack Web Application Generator allows you to choose the design of the app you create from a list of eye-catching variants.

Source – github.com/DanLowo/Chat-Application

Example №3 – A React-based chat app using chatengine.io Rest API

This React Chat App is on the list for such features as group creation and Google Account sign-in. This particular app also serves quite a noble purpose – giving people a platform to share their worries and thoughts with anyone willing to listen on an anonymous basis. So, for having a pure goal and for killer features on our example list it goes!

Source – reactjsexample.com/a-react-based-chat-app-using-chatengine-io-rest-api-and-has-features-of-creating-groups/

Example №4 – EfeChat by Alper Efe Şahin

We felt the need to add this example to our list as a way of conveying the message of simplicity. Mainly, the simplicity of usage the end-user should have while using your React Chat App. And EfeChat covers this point easily, as its features are quite simple and intuitive – features the presence of which a user might not notice. But trust us, the lack of these two features would be most visible for the user.

Source -github.com/alper-efe-sahin/EfeChat-Reactjs

Example №5 – cute-chat by Asif Azad

And we would like to finish our list with cute-chat – a simplistic, yet stylish in its own right chat, that brings us back to 2000’s chats like ICQ with its overall design. But that is not the main idea behind putting it on this list. That would be the necessity of making your React Chat App smartphone-adapted, just like cute-chat, as most of today’s internet traffic is coming from smartphones, rather than computers.

Source – bestofreactjs.com/repo/BRAINIAC2677-cute-chat-react-react-apps

Conclusions

As our article comes to an end, we would like to reiterate a couple of important points:

If you want your business to have more opportunities to succeed, it is important to have well-developed communications with a client, as well as many ways of communicating with them. That is why the creation of your own chat app and its subsequent insertion into your project would rarely, if ever, by a step in the wrong direction;
Building your chat app on React is a fast, efficient and scalable way of creating chat apps coding language-wise. It is even more efficient and fast to use Full Stack Web Application Generator for that purpose.

And that is all for today. We hope that you will find this article most helpful and useful. So, have a good day and, as always, feel free to read more of our articles.

Suggested articles

React Table Guide And Best React Table Examples
React Pagination Guide And Best React Pagination Libraries
22+ React Developer Tools to Increase Your Programming Productivity

The post React Chat App: How to Make a Chat Using Socket.io appeared first on Flatlogic Blog.

334: Custom Properties

Chris & Shaw talk about a big ol’ conversion to getting CodePen’s color system to use –custom-properties all the way through, rather than Sass variables. Why? All sorts of reasons, kinda boiling down to the fact that they are just better. Here’s a tiny one: you can use the Web Inspector and see what some other element is colored easily. Here’s a huge one: ability to do theming way easier. But the refactoring isn’t without some bumps in the road, like the fact that CSS doesn’t have a way to alter colors (like lighten, darken, or add alpha) terribly easily yet, meaning we needed some work arounds.

Time Jumps

01:01 Using Sass for colors

08:28 Prefixing our global variables

11:39 Theming all over CodePen

15:41 Switching away from Sass with colors

23:18 Sponsor: Retool

24:54 Future CSS Color Models coming

33:10 Buttons and custom properties

Sponsor: Retool for Startups

After working with thousands of startups, we’ve noticed that technical founders spend a ton of time building internal tools—which means less time on their core product. So, we built Retool For Startups—a program that gives early-stage founders free access to a lot of the software you need for great internal tooling.

The goal is to make it 10x faster to build the admin panels, CRUD apps, and dashboards that most early stage teams need. We’ve bundled together a year of free access to Retool with over $160,000 in discounts to save you money while building with software commonly connected to internal tools like AWS, MongoDB, Brex, and Segment.

We give you a head start with pre-built UI components, integrations, and other advanced features that make building from scratch much faster. To learn more, check out our site, apply, join webinars and much more at retool.com/startups.

The post 334: Custom Properties appeared first on CodePen Blog.

Flatlogic Admin Templates banner

333: Robert

New CodePen team member! As we recorded this, it was just Robert’s 2nd day at CodePen, and we snuck this podcast in within the hurricane of stuff happening during that time. There is a pile of new software to get access to and acquainted with. There is the dev environment stuff. There is getting acquainted with people, with the extra challenge of doing that remotely. There is understanding the flow and structure of our work days. There are meetings! So many meetings! Figuring out the Zoom culture.

For now though, we chat about Robert’s history and how we’re luck to have gotten someone with such deep expertise in the field. He lives right in Bend, Oregon where Chris is, hence them knowing each other through BendJS.

Timejumps

00:36 Guest introduction

01:37 Blind spots exposed by new hires

03:48 What’s it like to onboard at CodePen?

05:42 Sponsor: Jetpack

06:45 More about Robert

11:22 Is it important to work on things that matter to you?

15:03 A computer is a fancy wrench

20:16 Did Node draw you to Javascript?

25:35 Where CodePen is headed

Sponsor: Jetpack

It’s so cool that Jetpack acquired Social Image Generator. Jetpack already does stuff to help your WordPress site be better integrated with social media (check this video), so why not really go the extra mile and help you with those tricky-to-pull-off social media images? We’re all very much looking forward to see what new features this acquisition unlocks.

The post 333: Robert appeared first on CodePen Blog.

Flatlogic Admin Templates banner

332: Running the Finances of a Startup

Dee and Chris talk about “everything money-related” at CodePen. Dee has been managing this stuff since CodePen’s beginning. First largely pro-bono (sorry, Dee), then later as a side gig and part-time job. Dee is full-time now at CodePen, but finance stuff is only part of her role (programming being the main job). It’s a lot of work, but she likes being able to influence CodePen for the better from multiple angles.

At a big company, all this finance work would probably manifest as a COO. But CodePen is just a midling startup, too small really for a COO, but also too big for a homegrown spreadsheet. Dee gets into all the work that goes into finance, from the vital documents that are the Profit & Loss Statement, Balance Sheet, and Cash Flow, to other work like cohort analysis and cap table work.

Time Jumps

00:38 Working with numbers

01:50 How has money been managed at CodePen?

05:39 Outsourcing accounting

20:40 Sponsor: Retool

22:20 What is the finance job at CodePen?

32:43 Tooling for accounting

Sponsor: Retool for Startups

After working with thousands of startups, we’ve noticed that technical founders spend a ton of time building internal tools—which means less time on their core product. So, we built Retool For Startups—a program that gives early-stage founders free access to a lot of the software you need for great internal tooling.

The goal is to make it 10x faster to build the admin panels, CRUD apps, and dashboards that most early stage teams need. We’ve bundled together a year of free access to Retool with over $160,000 in discounts to save you money while building with software commonly connected to internal tools like AWS, MongoDB, Brex, and Segment.

We give you a head start with pre-built UI components, integrations, and other advanced features that make building from scratch much faster. To learn more, check out our site, apply, join webinars and much more at retool.com/startups.

The post 332: Running the Finances of a Startup appeared first on CodePen Blog.

Flatlogic Admin Templates banner

Top 30 Platforms to Learn React in 2021 (React Tutorial Digest)

The market of frontend developers is booming, and you surely know the main spots and platforms where to learn how to code, where to learn new frameworks and languages; how to fix simple bugs and errors, how to maintain and keep sites up-to-date, and so on and so forth. But nobody will take your hand and lead you through the whole process of development and dependencies. This process should be much slower and more painful without a good foundation and study platform with solid structures, consistently shown material and regularly updated material. The whole path may become significantly easier if you divide it into equal parts, and don’t try to take it hurriedly, from scratch.

Here you will see thoroughly curated platforms with up-to-date React tutorials from the web world. We’ve gathered a list of popular resources, how-to guidelines, articles, YouTube channels with really useful info presented by top-notch experts from the world of web development, as the best way to learn React. As a rule, they entail covering HTML5, CSS, and JavaScript basic concepts which are bootstrap conquering React fundamentals, and other instruments for building interactive web interfaces.

Probably, you could have faced such questions like is react hard to learn, or what is the best way to learn React. But there is no best way to learn React once and forever, as everywhere, everything takes time and effort.

Pick the one tutorial that best fits your needs!

The Best React Courses and Popular Platforms to Learn React:

1. Codecademy

Website: https://www.codecademy.com/

Learn React with Codeacademy! The course gives a strong understanding of the most important React concepts: JSX, class and function components, lifecycle methods, props, and hooks, etc.

● 20 Hours ● For those who already know the basics of JS and HTML

2. Udemy

Website: www.udemy.com

Udemy needs no introduction. This is an American online platform, a huge marketplace with over 155000 courses and 10 million monthly organic traffic. React – The Complete Guide is a top-rated course that became a bestseller among students of Udemy.

● 20 Hours ● All levels ● Price: $89.99

3. Coursera

Website: https://www.coursera.org/

I put 100 you’ve already surfed this platform. Coursera offers tons of courses for all-level developers and absolute zeros in web development. Right off bat, check this full-stack web-development course with React specialization from The Hong Kong University of Science and Technology.

At Coursera, you can start your 7-day free trial, and keep on learning for $49 per month after your trial period.

4. Code with Mosh

Website: http://codewithmosh.com

Moshfegh Hamedani is an inspired software developer with almost 2 million audience on YouTube and 20 courses on Udemi. He has 20 years of experience and keeps to teach React and other popular libraries, frameworks and programming languages on his own platfrom for mastering coding.

● 13 Hours ● All levels ● Price: all-access membership $29

5. Scrimba

Website: https://scrimba.com/

Bob Ziroll offers to learn React absolutely for free. This course contains 59 interactive screencasts and other really engaging material to learn React. Scrimba is  all about avid learning, creating cool stuff and helping others achieve their career goals. Scrimba motivates to become a developer faster, with all necessary resources inside. The platform has also an advanced course called React Bootcamp for experienced developers.

● Level: Advanced ● Price: $124/Year

6. Edx

Website: https://www.edx.org/

World-leading universities like MIT or Harvard offer their t programs and courses. For instance, Developing Cloud Applications with Node.js and React will tell yout how to create a server-side app and deploy it on Cloud.

±5 weeks ● All levels ● Price: free

8. Freecodecamp

Website: https://www.freecodecamp.org

It’s a really big community with its own tech-focused forum and a dozen of tutorials to learn React js. Just randomly dive into this list of free 7-hour React course by Beau Carnes. No worries about how to find the info, all the data is well organized by subsections.

● All levels ● Price: free

9. W3schools

Website: https://www.w3schools.com
W3school is a comprehensive platform with dozens of useful info. It offers a range of open-source tutorials, references, and exercises for developers.

● All levels ● Price: free

10. Careerkarma

Website: https://careerkarma.com/

Software engineering is not just a random collocation, here is a comprehensive guide from a self-taught programmer with really deep knowledge of JavaScript, HTML, and CSS, and Python. Click learn more to know how to learn React, how to start coding, and how to practice your skills.

● All levels ● Price: free

11. Developer.Mozilla: Getting started with React

Website: https://developer.mozilla.org/

Explore more about Mozilla references and guides. There is a good background and use cases, a basic React toolchain setting up process, and everything about how to create a simple starter app. Highly recommended site!

● All levels ● Price: free

12. Javatpoint
Website:

Website: https://www.javatpoint.com/

One more site that has explained all the common-known principles of ReactJS. Currently, it has a strong foundation and a large community as well on its site and on YouTube.

13. Ibaslogic

Website: https://ibaslogic.com/

If you don’t know where to start your path as a front-end developer, read this open-source React tutorial for beginners made by Ibas Majid, a self-taught web developer.

● 22 minutes ● Beginners

14. Reactforbeginners – React JS Crash Course

Website: https://reactforbeginners.com/

This platform aims to position itself as a premium step-by-step training course to dive you into the real world of React + Firebase apps and website components. The course is taught by Wes Bos, a Full Stack Developer, and experienced tutor from Canada. 

● 5 hours ● Beginners ● $82

15. Traversy Media

Website: https://www.traversymedia.com/

One more online platform for developers to learn JavaScript and its frameworks is Traversy Media. There are well-known programming tutorials for all of the latest web technologies starting from the building blocks of HTML. Check their Reactjs Crash course updated in 2021 to understand the core things about React library.

16. Class Central – Free Online React Courses

Website: https://www.classcentral.com/

Full learning courses from the leading universities, like The Hong Kong University of Science and Technology, Filter out the courses by language, by duration, by level, with/or without a certificate. Read out reviews to decide which React course is the right fit for you.

17. Web Dev Simplified

Website: https://courses.webdevsimplified.com/
YouTube: https://www.youtube.com/channel/UCFbNIlppjAuEX4znoulh0Cw

An awesome source of tutorials for self-studying developers. Web dev simplified has a very informative YouTube channel. Learn React today course offers to get the gist of React in less than a day and build your first project quicker.

● 20 hours ● 21 lectures ● $60
Duration: 40 hours

18. Solo Learn

Website: https://www.sololearn.com/

The main concepts from the world coder community. Build powerful interactive user interfaces with React library trusted by devs from Facebook and Uber. The platform has various courses, code playground, blog, and a general audience of more than 200k visitors a month.

19. Ihatetomatoes

Petr Tichy, an Australian Front End Developer, offers to learn React Hooks API, how to use Fetch API to load data, how to render a dynamic dropdown in your React app, and many other essential questions. Here you’ll also find the Ihatetomatoes YouTube channel.

20. Visualstudio code

Website: https://code.visualstudio.com/docs/nodejs/reactjs-tutorial

A step-by-step guide on how to create a React app with create-react-app generator.

21. Tutorialspoint

Website: tutorialspoint.com/

Online education is the best way to gain new skills faster. Tutorialspoint offers multi languages tutorials, ebooks, prime packs and more. Check out the features, advantages, and limitations of the course. Create React App step by step with Tutorialspoint quick guide.

22. PedroTech

Website: https://www.youtube.com/c/PedroTechnologies/

Pedro Machado offers a wide range of videos about Web Development! ReactJS, NodeJS, MySQL, Express, MongoDB, and much more! Reactjs beginner course is also available.

23. React Casts

Website: https://www.youtube.com/c/reactcasts

Here is a channel with short React screencasts containing tips, tricks, and tutorials. Yes, it’s relatively new, but still informative and a good way to know to learn React.

24. HarryWolf

Website: https://www.youtube.com/c/hswolff/videos

Harry Wolfs shares his in-depth experience and personal opinion for JavaScript, its tricks, and many more useful things related to programming. He is a brilliant tutor who explains everything in detail and gives his personal view on this or that programming aspect.

25. The Net Ninja

Website: https://www.youtube.com/channel/UCW5YeuERMmlnqo4oq8vwUpg

Just a golden channel with more than 1000 programming tutorials about JavaScript, React, Vue, Laravel, Firebase, etc. It’s a must to check it out and find your best video to learn Reactjs together with other 778K of subcribers.

26. Anthony Sistilli

Website: https://www.youtube.com/c/anthonysistilli

Here you will find 20-minute React tutorials on different aspects of React: React props, React Router basics, conditional rendering, and other essential things important for a front-end developer.

 27. Chris Hawkes

Website: https://www.codehawke.com/

Chris Hawks offers React advanced crash course as the best way to learn React. The author has an online platform with React course for beginners and a tutorial for advanced React coders. More videos can be found on his YouTube channel.

28. Codevolution

Website: https://learn.codevolution.dev/

Codevolution is a popular source of tutorials on the latest tech in web development! Here you can follow the trends in programming and find out what’s new in React 18.

29. Academind

Website: https://academind.com/

Max and Manuel offer to start learning React.js and how to build amazing websites just for free! These guys share their deep expertise in the form of tutorials here, and in the form of video courses on YouTube. The channel has more than 708k subscribers! We also recommend taking a premium course on NextJS & React – The Complete Guide.

24 hours ● All levels ● Price: $39 for a single course license

30.  Dev Ed

Website: https://www.youtube.com/c/DevEd

Really creative channel to be guided through React and other development tools. Here you will find tutorials on web development, UI instruments, and other tools for web and mobile app development. And 686k of subscribers only prove that this chap from Romania makes superb educational content.

Recap

If you don’t need a full course but are more likely to read some guide or article to resolve specific purposes, we could recommend learning more about online workshops on smashing magazines. One more proven source of high-quality information is the tutorial-focused blog of LogRocket.

We are always happy to share with you everything on React that we know ourselves. It’s never too late to learn something new! So, learn smarter with React tutorials created by Flatlogic. Check out the blog with in-depth thematic articles on React, Angular, Vue, Bootstrap, and many other highly useful aspects of web development. Find your best place to learn React, study hard, and dream big!

The post Top 30 Platforms to Learn React in 2021 (React Tutorial Digest) appeared first on Flatlogic Blog.

Flatlogic Admin Templates banner

New Pinned Items UI

In the olden days (like, a few weeks ago), the Pinned Items UI was much less capable. You could certainly pin things, and open up a menu to see a list of what you pinned, but there wasn’t any context. There was no visual preview to quickly identify them. There was no metadata like when it was created or updated.

We’ve updated the UI so now you’re Pinned Items always open up in a modal (it’s the same everywhere now) and you can flip between grid view:

And list view:

We’re hoping this will make it much more convenient to get to items you want to really quickly get back to from no matter where you are on CodePen.

The post New Pinned Items UI appeared first on CodePen Blog.

Flatlogic Admin Templates banner

331: Next.js + Apollo + Server Side Rendering (SSR)

Our goal here was to explore server-side rendering (SSR) in Next.js using data from Apollo GraphQL, for faster client-rendering and SEO benefits.

There are a variety of approaches, but Shaw has set his sights on a very developer-ergonomic version here where you can leave queries on individual components and mark them as SSR-or-not.

There are two “official” approaches:

Apollo’s documentation
Next.js’ example

These are sorta-kinda-OK, except…

They have to be configured per-page
They are mostly limited to queries at the top page level
You’d likely need to duplicate queries with slightly differently handling from client to server
May or may not populate the client cache so that the client can have live queries without having to query for the same data. For example, ay you have data that you want to change on the client side (pagination, fetching new results). If it’s fetched and rendered server-side, you have to fetch again client side or send over the cache from the server so the queries on the client-side can be ready to update with new data.

These limitations are workable in some situations, but we want to avoid duplicating code and also have server-side rendered queries that aren’t top-level on the page.

A probably-better approach is to use the getDataFromTree method, which walks down the tree and executes the queries to fill up the ApolloClient cache. We got this from a two-year old Gist from Tylerian showing a way to integrate getDataFromTree into Next.js. Tylerian’s gist had some extra complications that might’ve been due to older Next.js limitations, but the overall process was sound:

Create a shared ApolloClient instance
Render the page using getDataFromTree() to fill the cache with data
Render the page again with that data using Next’s Document.getInitialProps()

Extract the cache to deliver with the page and hydrate the client-side Apollo cache

The benefits:

Quick to set up
No duplicate queries
Nothing special per page to handle server-side rendering or client-side queries.
Cache hydration to keep client active without re-querying data
Easy to enable / disable server-side rendering for individual queries

Here’s a repo with Shaw’s findings.

Sponsor: Retool

Retool, a fantastic tool for quickly building internal tools, has an even-more-fantastic program tailored to startups. If you have a startup founded less than 5 years ago with less than 10M in funding, you qualify. You’ll not only get 12 months of Retool for gree, but $160,000 of partner deals from companies like AWS, Intercom, Segment, Sentry, Digital Ocean, MongoDB, and more. Go apply!

The post 331: Next.js + Apollo + Server Side Rendering (SSR) appeared first on CodePen Blog.

Flatlogic Admin Templates banner

Best libraries for React I18n

Internationalization is an integral part of modern software development. In addition to English-speaking countries, there are still many paying markets where a project may not be successful without internationalization and localization. Different studies show that 72% of consumers are more likely to stay on a website if it is been translated. Moreover, 55% of consumers said they only buy from websites that are in their native language.

In this regard, the question arises of how to do internationalization at the software development level, namely in the React framework.

In this article, we will look at what internationalization is, how to do internationalization using the i18next library as an example, consider the best internationalization libraries for React, and also find out the difference between internationalization and localization.

What is Internationalization

Internationalization is the process of translating your application into different languages. Internationalization or i18n is the design and development of a product, application, or document content that enables easy localization for target audiences that vary in culture, region, or language.

Translation of the application includes many aspects, such as changing the date, language, position of letters, and the like. Unicode usage, legacy character encodings, string concatenation, etc. are some of the things which assist in designing an application to ensure successful internationalization.

Difference between internationalization and localization

Software localization is different from internationalization (i18n). Internationalization covers areas such as software development and design across different cultures and languages. In other words, internationalization is what allows localization to happen in the first place. Internationalization is typically done by software developers, while localization is done by translators.

Also, an important aspect of internationalization is instead of writing code for each language, you replace code with placeholders that automatically retrieve the correct language for the user without engineering changes.

With localization, you can not only customize the language preference but also number formats, date and time formats, currency formats, keyboard layout, sorting and collection, text direction, and even colors and designs.

Localization also can include the cultural and country-specific aspects of different languages, such as:

Accounting standards;
Links and other resources;
Calendars;
Hand symbols, gestures, or signage;
Culturally appropriate images;
Dates and times;
Spelling and phrasing, such as the differences between the Spanish spoken in Argentina and Spain;
Right-to-left languages like Arabic or Hebrew.

React Internationalization guide

Base project

The basic project for us will be a simple page of text with personal information in two languages – German and English, with text switching by means of a button. We will develop our application using create-react-app.

Prerequisites

This tutorial assumes that you have installed the latest version of Node.js and npm or yarn on your device. Moreover, you need to have some experience with simple HTML, JavaScript, and basic npm and Yarn commands, before jumping to React i18n.

You can view the code for my application by following the following link on GitHub.

Getting Started

In this section, I will help you understand the integration between i18next and React. To make things a bit easier and smooth, we will make use of the Create React App package by Facebook.

The first step is to install the latest release of Create React App. To do this, open console/terminal depending on your operating system and enter the following command:

yarn create react-app [name of your app]

After the setup is complete, type this command in the console and run it.

cd [name of your app]

It will take you to the folder of the project.

Then run the following command to test if the application is installed correctly.

yarn start

If everything is working correctly you will see the working app on the localhost port.

Installing dependencies and making the actual application

Let’s install all required dependencies to develop our i18n application.

yarn add i18next react-i18next i18next-browser-languagedetector

The browser language detector automatically detects the language of your location.

We also use react-bootstrap in our application, but it is optional.

Let’s create the content for the translation. In my case, it will be the information about me and the page look like my personal in app.js file. The code will look like that:

import React from ‘react’;
import Container from ‘react-bootstrap/Container’;
import Jumbotron from ‘react-bootstrap/Jumbotron’;
import Row from ‘react-bootstrap/Row’
import Col from “react-bootstrap/Col”;
import me from ‘./me.jpg’

function App () {

return (

<Container>
<Jumbotron>
<Row>
<Col>
<p>I am a Product Owner at Flatlogic.com. The company creates templates on top of Javascript technologies and help to integrate these dashboards into existing products. During 3 years we grow our customer base over the 70k users and have almost 100k monthly visitors on our website.</p>
<p>Previously I was a co-founder of Kuoll, an error analytics platform for e-commerce. Together with my partner, I went from MVP to the first paid users and increased the user base from 100 to more than 750, which included learning programming, product management, marketing and sales, user support.</p>
<p>Before founding Kuoll I was an Audit Staff at Ernst & Young where I helped analyze data and business, perform general substantive audit procedures for Fortune 5000 companies.</p>
<p>I was fortunate enough to be alumni of one of the largest startup accelerators in Nordic and Baltic states, Startup Sauna and Starta Accelerator in New York. Now, I am also receiving BA in Computer Science at University of London. I also love running, cycling, my wife Yuliya and daughter Sasha.</p>
</Col>
<Col>
<img src={me} alt=”Eugene Stepnov” id=”me” />
</Col>
</Row>
</Jumbotron>
</Container>
)
}

export default App;

The components like <Jumbotron>, <Container> and others are from react-bootstrap. This is a basic personal page.

Next, we will need to create a file where the text of our translation, the configuration will be stored, as well as the plug-in from i18next will be loaded, our file will be called translation.js and will look like this:

import i18n from ‘i18next’;
import {initReactI18next, Trans} from “react-i18next”;
import LanguageDetector from ‘i18next-browser-languagedetector’;
import React from “react”;

i18n
.use(initReactI18next)
.use(LanguageDetector)
.init({
// we init with resources
resources: {
en: {
translations: {
“I am a Product Owner at Flatlogic.com. The company creates templates on top of Javascript technologies and help to integrate these dashboards into existing products. During 3 years we grow our customer base over the 70k users and have almost 100k monthly visitors on our website.” : “I am a Product Owner at Flatlogic.com. The company creates templates on top of Javascript technologies and help to integrate these dashboards into existing products. During 3 years we grow our customer base over the 70k users and have almost 100k monthly visitors on our website.”,
“Previously I was a co-founder of Kuoll, an error analytics platform for e-commerce. Together with my partner, I went from MVP to the first paid users and increased the user base from 100 to more than 750, which included learning programming, product management, marketing and sales, user support.” : “Previously I was a co-founder of Kuoll, an error analytics platform for e-commerce. Together with my partner, I went from MVP to the first paid users and increased the user base from 100 to more than 750, which included learning programming, product management, marketing and sales, user support.”,
“Before founding Kuoll I was an Audit Staff at Ernst & Young where I helped analyze data and business, perform general substantive audit procedures for Fortune 5000 companies.” : “Before founding Kuoll I was an Audit Staff at Ernst & Young where I helped analyze data and business, perform general substantive audit procedures for Fortune 5000 companies.”,
“I was fortunate enough to be alumni of one of the largest startup accelerators in Nordic and Baltic states, Startup Sauna and Starta Accelerator in New York. Now, I am also receiving BA in Computer Science at University of London. I also love running, cycling, my wife Yuliya and daughter Sasha.” : “I was fortunate enough to be alumni of one of the largest startup accelerators in Nordic and Baltic states, Startup Sauna and Starta Accelerator in New York. Now, I am also receiving BA in Computer Science at University of London. I also love running, cycling, my wife Yuliya and daughter Sasha.”
}
},
de: {
translations: {
“I am a Product Owner at Flatlogic.com. The company creates templates on top of Javascript technologies and help to integrate these dashboards into existing products. During 3 years we grow our customer base over the 70k users and have almost 100k monthly visitors on our website.” : “Ich bin Product Owner bei Flatlogic.com. Das Unternehmen erstellt Vorlagen auf Javascript-Technologien und hilft bei der Integration dieser Dashboards in bestehende Produkte. Während 3 Jahren haben wir unseren Kundenstamm auf über 70.000 Benutzer erweitert und haben fast 100.000 monatliche Besucher auf unserer Website.”,
“Previously I was a co-founder of Kuoll, an error analytics platform for e-commerce. Together with my partner, I went from MVP to the first paid users and increased the user base from 100 to more than 750, which included learning programming, product management, marketing and sales, user support.” : “Zuvor war ich Mitgründer von Kuoll, einer Fehleranalyseplattform für E-Commerce. Zusammen mit meinem Partner bin ich vom MVP zu den ersten kostenpflichtigen Nutzern aufgestiegen und habe die Nutzerbasis von 100 auf über 750 erhöht, was Lernprogrammierung, Produktmanagement, Marketing und Vertrieb, Nutzersupport beinhaltete.”,
“Before founding Kuoll I was an Audit Staff at Ernst & Young where I helped analyze data and business, perform general substantive audit procedures for Fortune 5000 companies.” : “Vor der Gründung von Kuoll war ich als Audit Staff bei Ernst & Young tätig, wo ich bei der Analyse von Daten und Geschäften sowie bei der Durchführung allgemeiner substanzieller Auditverfahren für Fortune 5000-Unternehmen half.”,
“I was fortunate enough to be alumni of one of the largest startup accelerators in Nordic and Baltic states, Startup Sauna and Starta Accelerator in New York. Now, I am also receiving BA in Computer Science at University of London. I also love running, cycling, my wife Yuliya and daughter Sasha.” : “Ich hatte das Glück, Alumni eines der größten Startup-Accelerators in den nordischen und baltischen Staaten zu sein, Startup Sauna und Starta Accelerator in New York. Jetzt erhalte ich auch einen BA in Informatik an der University of London. Außerdem liebe ich Laufen, Radfahren, meine Frau Yuliya und meine Tochter Sasha.”
}
}
},
fallbackLng: ‘en’,
debug: true,
ns: [‘translations’],
defaultNS: ‘translations’,
keySeparator: false,
interpolation: {
escapeValue: false,
formatSeparator: ‘,’
},
react: {
wait: true
}
});
export default i18n;

Thus, in resources, you need to place your translation opposite each key.

Next, we need to update our root component to use this i18n config inside the index.js:

Just import ‘./translations’;

Let’s get back to our main App.js file to use our translation. The first step would be to import the i18next library.

​​import { useTranslation, Trans } from ‘react-i18next’;

Next, let’s add some variables regarding our translation and language switcher. Add this code to the App function:

const { i18n } = useTranslation();
const changeLanguage = (lng) => {
i18n.changeLanguage(lng);
};

And this code in return() to change language:

<button onClick={() => changeLanguage(‘en’)}>en</button>
<button onClick={() => changeLanguage(‘de’)}>de</button>

The final step would be to wrap our text into the <Trans> component which enables you to nest any react content to be translated as one string. Supports both plural and interpolation. 

<p><Trans>I am a Product Owner at Flatlogic.com. The company creates templates on top of Javascript technologies and help to integrate these dashboards into existing products. During 3 years we grow our customer base over the 70k users and have almost 100k monthly visitors on our website.</Trans></p>

And that’s all, the final code for App.js is looking now like this:

import React from ‘react’;
import Container from ‘react-bootstrap/Container’;
import Jumbotron from ‘react-bootstrap/Jumbotron’;
import Row from ‘react-bootstrap/Row’
import Col from “react-bootstrap/Col”;
import { useTranslation, Trans } from ‘react-i18next’;
import me from ‘./me.jpg’

function App () {

const { i18n } = useTranslation();
const changeLanguage = (lng) => {
i18n.changeLanguage(lng);
};

return (

<Container>
<button onClick={() => changeLanguage(‘en’)}>en</button>
<button onClick={() => changeLanguage(‘de’)}>de</button>
<Jumbotron>
<Row>
<Col>
<p><Trans>I am a Product Owner at Flatlogic.com. The company creates templates on top of Javascript technologies and help to integrate these dashboards into existing products. During 3 years we grow our customer base over the 70k users and have almost 100k monthly visitors on our website.</Trans></p>
<p><Trans>Previously I was a co-founder of Kuoll, an error analytics platform for e-commerce. Together with my partner, I went from MVP to the first paid users and increased the user base from 100 to more than 750, which included learning programming, product management, marketing and sales, user support.</Trans></p>
<p><Trans>Before founding Kuoll I was an Audit Staff at Ernst & Young where I helped analyze data and business, perform general substantive audit procedures for Fortune 5000 companies.</Trans></p>
<p><Trans>I was fortunate enough to be alumni of one of the largest startup accelerators in Nordic and Baltic states, Startup Sauna and Starta Accelerator in New York. Now, I am also receiving BA in Computer Science at University of London. I also love running, cycling, my wife Yuliya and daughter Sasha.</Trans></p>
</Col>
<Col>
<img src={me} alt=”Eugene Stepnov” id=”me” />
</Col>
</Row>
</Jumbotron>
</Container>
)
}

export default App;

The application will work like this if everything runs smoothly.

Best internazialiation libraries

Let’s take a look at the most well-known React i18n libraries. Before that, let’s see what options to use when looking for the right package for your app.

Documentation and maintenance of the package;

Feature / Library;
Pluralizations;
Nesting;
How big is the community;
Number Formats
Date formats;
Relative dates;
HTML support;
Performance/bundle size;
Interpolation.

NPM Trends

Also, one of the important factors before starting to use the library is its popularity among other developers. As for the internationalization topic, judging by npm trends, the most popular library is i18next – let’s get ahead of ourselves and say that this is justified since the library is the easiest and most understandable to use.

Now let’s go directly to the overview of popular libraries.

i18next

I18next is an internationalization library that has been written for JavaScript and its frameworks. It provides a complete method for localizing the product as well as the other standard i18n features.

I18next is already a whole platform for managing the localization of your applications. The library has many plugins and integrations at its disposal, as well as a SaaS application for management. Some of these are a plugin to detect user’s language, loading & caching translations that might be handy for large scale apps.

One of the most important features of i18next is scalability. This allows the library to separate translations into multiple files and load them on demand.

The other good advantage of i18next over other libraries is sustainability, it was created in 2011 and is still constantly developed.

Features

Highly effective and efficient API;
Ecosystem;
Maturity;
Language detection;
All tools to do complete localization.

Formatjs (React intl)

The react-intl library comes as a part of the FormatJS internationalization libraries. React-intl is one of the most popular libraries for the internationalization of React applications. It supports more than 150 languages globally. Library provides React components and an API to format dates, numbers, and strings, including pluralization and handling translations. It has a very larger community because it is the first i18n react library in the market.

React-intl provides react components and API to translate dates, numbers, currencies, and strings including pluralization.

However, the library has some disadvantages. You cannot use it for non-react components as it requires the top-level component to inject the context to the children.

React intl universal

React-intl-universal is developed by Alibaba Group and has all set of features to develop applications with internationalization. This library is one of the most popular solutions for i18n in React. It builds on top of React-intl and it enables even the non-React components to make use of the library by providing a singleton object to load the locale. For instance, this can be used in Vanilla JS as stated in the documentation itself.

Features

Can be used not only in React.Component but also in Vanilla JS;
Simple. Only three main API and one optional helper;
Display numbers, currency, dates and times for different locales;
Pluralize labels in strings;
Support variables in message;
Support HTML in message;
Support for 150+ languages;
Runs in the browser and Node.js;
Message format is strictly implemented by ICU standards;
Locale data in nested JSON format are supported;
react-intl-universal-extract helps you generate a locale file easily.

Lingui JS

LinguiJS for React is the smallest of all i18n libraries available today for react applications. It uses ICU messages syntax and rich-text messages. Powerful CLI is included too to manage all the translation workflows.

Notable features

Very small size;
CLI;
Good support from community;
Well documented;
Rich-text support.

React translated

React translated isn’t a very popular library, but very simple. The library is updating once a year. 

Features

Data interpolation;
Component interpolation;
Markdown inline-manipulations;
Custom manipulations, pluralizations, and grammar rules based on input data;
Component-level translation files (enables loading only required translations).

To translate the content of your app you just need to do two steps:

Create a translation file that will contain a mapping of keys to the string in each language you support;
Connect the Provider and wrap the top-level component with the <Provider> component according to props.

Conclusion

In this article, we got acquainted with the definition of internationalization, looked at how to make a simple application with translation using the i18next library, and also looked at the best libraries for internationalization.

If you liked the article, then we would be happy if you share it with the world and leave us feedback.

Thank you!

The post Best libraries for React I18n appeared first on Flatlogic Blog.

Flatlogic Admin Templates banner