teleren/devto huggingface dataset:
React Pattern Question
Tags: react, reacthooks
Published: 2019-02-18 16:58:31

---
title: React Pattern Question
published: true
description: Using react hooks, 
tags: react, reacthooks
---

Hey there,

I have been trying out the new React hooks, and I ended up coming to a point where a component has it's own store and actions baked into itself and the parent can access those as needed. 

The use case: There is a need to display the data from my component or have the ability to trigger functions from the parent (without having to go through a library like redux).

My Question: Is this an okay set up for a component in React or is it an anti-pattern?

The Code ([working jsfiddle](https://jsfiddle.net/k5yhw3at/1/)):
```javascript
import React, { useState } from 'react';

const ChildComponent = (prop1) => {
  const [myCustomValue, updateMyCustomValue] = useState(0);
  
  const myCustomAction = () => {
    updateMyCustomValue(myCustomValue + 1);
  }

  const view = () => (
    <input type="button" onClick={myCustomAction} value={`${myCustomValue} - ${prop1}`} />
  );

  return {
    store: myCustomValue,
    actions: myCustomAction,
    view,
  };
};

const ParentComponent = () => {
  const prop1 = 'test';

  const Test1 = ChildComponent(prop1);

  return (
    <div>
      <div>
        <h2>Component Default View</h2>
        <Test1.view />
        <h2>Parent can also trigger updates and show data from component</h2>
        <input type="button" onClick={Test1.actions} value={Test1.store} />
      </div>
    </div>
  );
}
```
Prettier Code
Published: 2019-02-18 16:56:39

---
title: Prettier Code
published: true
canonical_url: https://xam.io/2019/prettier-code/
description: 
tags: 
---

If you care about code formatting, you might want to take a look at [Prettier](https://prettier.io/). It changed the way I think about coding styles quite a bit.

So I used to spend a lot of time fiddling with code styles. From debating spaces vs. tabs to comparing [Symfony's Coding Standards](https://symfony.com/doc/current/contributing/code/standards.html) and [Google's Styleguides](https://github.com/google/styleguide). With JavaScript starting to be the language of choice for most new projects, I settled on the [Airbnb JS Style Guide](https://github.com/airbnb/javascript) and with the matching linter rules the topic was settled for quite some time.

But half a year ago, we decided at work to use [Prettier](https://prettier.io/) for a new project. And this has changed how I think about code styleguides in a pretty fundamental way: I just don't care anymore.

What prettier does: Instead of looking at the code style as it was written and applying rules on it, Prettier parses the code and prints it in its own format. So the leeway classic styleguides give every developer isn't a topic to ponder on anymore.

Like many linters, it automatically reformats the files on saving. At first it felt like a heavy intrusion in my work. After all I  – at least pretended – to put some effort and pride into the styling of the code I wrote. But a few days later I almost completely stopped thinking about code formatting. Months later I'm on the other end: I write code and am always heavily confused, if it doesn't automatically get reformated in the now familiar Prettier-style.

So if you happen to start a fresh project, just give Prettier a try for a couple of days.
Protecting sensitive data using Secret Manager in .Net Core
Tags: dotnetcore, csharp, dotnet, security
Published: 2019-02-18 16:49:53

Accidentally pushing sensitive data stored in application config into source controls!!! Thankfully this happens to many not only you :stuck_out_tongue_winking_eye:. It feels good when you have a company doing mistakes or anything else.

So here is how to make sure this does not happen again. There are [multiple ways](https://docs.microsoft.com/en-us/aspnet/core/fundamentals/configuration/?view=aspnetcore-2.2#providers) to protect, the one we will learn now is using Secret Manager tool in #dotnetcore.

All we have to do use *`dotnet user-secrets`* this command. Before using it remove the sensitive value of the property you are trying to hide. 

In my case it is *"TwilioAuthToken":""* in *appsettings.json* file.

Now in the terminal run this below command,

`dotnet add package Microsoft.Extensions.SecretManager.Tools`

We have the necessary tools required to run the commands on *user-secrets*. 

Lets create a key value vault for our project in **.csproj* file like this

```
<PropertyGroup>
  <UserSecretsId>LocalKeyVault</UserSecretsId>
</PropertyGroup>
```

Once you have a vault create we can now add/remove key value using this command

`dotnet user-secrets set TwilioAuthToken <secretcodegoeshere>`

In-case you have settings grouped like this
```json
"Telegram":{
    "TelegramBaseAddress":"https://api.telegram.org/bot",
    "TelegramAPIKey":""
  }
```
Use the command this way

`dotnet user-secrets set "Telegram:TelegramAPIKey" "<secretcodegoeshere>"`

Done! Now accessing this using `configuration["TwilioAuthToken"]` gets me the config value from  `%AppData%\Microsoft\UserSecrets\LocalKeyVault\secrets.json` Which I am sure is not gonna get checked-in mistakenly :stuck_out_tongue_winking_eye:

-Originally Blogged on [Bitsmonkey](https://bitsmonkey.blogspot.com/2019/02/protecting-sensitive-data-using-secret.html)
-Photo by Micah Williams on Unsplash
Simple and Reusable React DatePicker library !!
Tags: react, datepicker, timepicker
Published: 2019-02-18 16:24:26

---
title: Simple and Reusable React DatePicker library !!
published: true
description: React Datepicker Library
tags: 
 - react
 - datepicker
 - timepicker
---

Hi, I 'am Hosung Lim 
I want to introduce the library that I made.
Simple and Reusable react-datepicker library 
The repository links are as follows:
https://github.com/y0c/react-datepicker
React Native App with Custom Drawer Navigation, Calendar, Video, Charts, Timeline and Map
Tags: reactnative, ios, android, drawer
Published: 2019-02-18 15:52:16

---
title: React Native App with Custom Drawer Navigation, Calendar, Video, Charts, Timeline and Map
published: true
description: https://github.com/asifsha/rn-nav
tags: #reactnative #ios #android #drawer 
---
Who's looking for open source contributors? (Feb 18th edition)
Tags: discuss, opensource, contributorswanted
Published: 2019-02-18 15:49:03

---
title: Who's looking for open source contributors? (Feb 18th edition)
published: true
description: 
tags: discuss, opensource, contributorswanted
---

Find something to work on or promote your project here.

Please shamelessly promote your project. Everyone who posted in previous weeks is welcome back this week, as always. 😄

**The comment template below is optional.**

Happy coding!
Weekly-digest: summary of activity on your GitHub repository
Tags: githunt, github
Published: 2019-02-18 15:37:53

---
title: Weekly-digest: summary of activity on your GitHub repository
published: true
description: 
tags: githunt, github
---

This bot gives me a super thorough snapshot of the dev.to repo each week. I can see a list of new issues, closed issues, merged PRs, commits, people who starred the repo, and much more. It's awesome! Here's an example of the issue it creates: 

{% github https://github.com/thepracticaldev/dev.to/issues/1816 %}

and their repo: 

{% github https://github.com/probot/weekly-digest %}
Pagination done
Tags: webdev, rails, beginners
Published: 2019-02-18 15:18:25

---
title: Pagination done
published: true
description: Added pagination to the blog posts
tags: webdev, rails, beginners
---

After a few days of much-needed break, it was time to get back to adding features to my blog project. Today's assignment was adding pagination to the blog posts. In order to get this feature working, I used the [will_paginate](https://rubygems.org/gems/will_paginate) gem. On the gem file, I added `gem 'will_paginate', '~> 3.1', '>= 3.1.6'`, and ran a quick `bundle install` that install the required gem. 

Then, it was all about following the [documentation](https://github.com/mislav/will_paginate/wiki) of the gem. 

First, off I updated the posts controller for my index method. 

```
 def index
  @post = Post.all.order('created_at DESC').paginate(:page => params[:page], :per_page => 3)
   end

```

As you can see the `.paginate` has been added, and I've followed the documentation. Also, I had set three articles to be shown per page. 

Once this was done, the page updated itself to show only three articles on a page. Now I needed to add the pagination in the view itself so that the users can navigate on the website. For this, I used

```
<%= will_paginate @post %>
```
Once this was done, I got the pagination working with a navigation menu. However, I still needed to add a bit of style to the menu so that they looked good. For this, I could use bootstrap, something that I had already been using for my app.

I used the gem [bootstrap_will_paginate](https://rubygems.org/gems/bootstrap-will_paginate)  for this via `gem 'bootstrap-will_paginate', '~> 1.0'`. Again, I ran bundle install, and finally on the views, I added the styling by following the [documentation](https://github.com/yrgoldteeth/bootstrap-will_paginate) of the gem.

```
 <%= will_paginate(@post, :renderer =>
WillPaginate::ActionView::Bootstrap4LinkRenderer) %>

```


The pagination was now ready to be used.
The 7 Most Popular DEV Posts from the Past Week
Tags: top7
Published: 2019-02-18 15:11:15

---
title: The 7 Most Popular DEV Posts from the Past Week
published: true
description: A round up of the most-read and most-loved contributions from the community this past week.
tags: icymi
cover_image: https://thepracticaldev.s3.amazonaws.com/i/sfwcvweirpf2qka2lg2b.png
---
Every Monday we round up the previous week's top posts based on traffic, engagement, and a hint of editorial curation. The typical week starts on Monday and ends on Sunday, but don't worry, we take into account posts that are published later in the week. ❤️

#1. Don't Take DEVs For Granted!

Send this post to anyone who thinks programming is equivalent to the 'hacking' portrayed in Hollywood films. In Some Dood's (great username) article, we journey through all the difference pieces of the puzzle a dev needs to consider.

{% link https://dev.to/somedood/programming-is-hard-2p87 %}

#2. Oft-overlooked

Max is back with another "Intro I Wish I had" post! This time it's all about testing: different types of test, why testing matters, and general rules of thumb.

{% link https://dev.to/maxwell_dev/the-testing-introduction-i-wish-i-had-2dn %}

#3. Right From Your Terminal!

This is awesome. Sarthak built a way to access dev.to (this site) straight from the command line. Check it out 👇

{% link https://dev.to/teamxenox/devto-cli-a-valentines-day-gift-to-my-favorite-people-56bd %}

#4. How To Manage It All

Steph breaks down common beliefs surrounding time management, highlights the benefits of sticking with a job but still being a maker, and helps us optimize our life.

{% link https://dev.to/stephsmithio/you-dont-need-to-quit-your-job-to-make-12kg %}

#5. Hot Topic

Michael has experience with both WebStorm and Visual Studio Code. In this post, they share why WebStorm is now their preferred choice for development.

{% link https://dev.to/mokkapps/why-i-switched-from-visual-studio-code-to-jetbrains-webstorm-939 %}

#6. Recommended Reading

Antonin shares a list of books that helped them become a better developer.

{% link https://dev.to/antjanus/the-books-that-made-all-the-difference-to-me-as-a-developer-1ijn %}

#7. A Grand Plan

A personal story about leaving a job to chase entrepreneurial dreams - "sometimes you need to risk it to get the biscuit..!"


{% link https://dev.to/turnerj/i-left-my-job-today-f1a %}

_That's it for our weekly wrap up! Keep an eye on dev.to this week for daily content and discussions...and if you miss anything, we'll be sure to recap it next Monday!_
Welcome Thread - v29
Tags: welcome
Published: 2019-02-18 14:58:19

---
title: Welcome Thread - v29
published: true
description: Introduce yourself to the community!
tags: welcome
---

Hey there! Welcome to dev.to!

![WELCOME TO THE INTERNET](https://slack-imgs.com/?c=1&url=http%3A%2F%2Fmedia0.giphy.com%2Fmedia%2FzhbrTTpmSCYog%2Fgiphy-downsized.gif)

Leave a comment below to introduce yourself to the community! ✌️

Here are some ideas to get you started:

1. You can talk about what brought you here, what you're learning, or just a fun fact about yourself.

2. Reply to someone's comment and say hello or ask them a question. 👋

3. Or answer this question: would you say you're an introvert or an extrovert?
Software Design Questions
Tags: cleancode, designpatterns, laravel
Published: 2020-01-10 07:32:58

---
title: Software Design Questions
published: true
date: 2019-02-18 07:46:09 UTC
tags: clean code,design patterns,Laravel
canonical_url: 
---

I’ve started reading a book on [design patterns](https://refactoring.guru/design-patterns) which has made me wonder what kind of questions to ask when thinking about structuring one’s code. Recently I started to migrate the Learnclick code from CodeIgniter to Laravel (at the moment just for practice purposes). While thinking about design patterns etc, I realized that I could easily get paralyzed by the process of thinking about how to write the most maintainable and clean code.

I decided to start somewhere and then start refactoring as I don’t want methods to become too big. This then automatically led to the question, what classes to create and if I should use [inheritance or composition](https://sergeyzhuk.me/2017/01/08/composition-over-inheritance/). One thing that stuck out for me when looking at design patterns was that one should always try to create an interface for things that have different implementations but work similar. Interfaces are an important concept of [object oriented design](https://en.wikipedia.org/wiki/Object-oriented_design). Then we can start thinking about design patterns, but they should be more of a guideline rather then an exact way of doing things, like [this article](https://dev.to/geraldcroes/dont-use-design-patterns-8pn) helpfully explains.

There is still a lot to learn, but I think the new way I’ve designed the Learnclick part for generating different types of questions is already a lot better than what I did before when I used a more procedural programming style. My issue in the past used to be that although I understood the principals of object oriented design, I couldn’t transfer the examples of cats & dogs to more abstract ideas.

![](http://www.programming-decoded.com/wp-content/uploads/2019/02/questions_UML.png)<figcaption>Learnclick Question classes UML</figcaption>

How do you go about designing your software code? Please leave a comment.
Last night my side project made one person happy, and someone else pissed off
Tags: showdev, discuss
Published: 2019-02-18 14:35:40

---
title: Last night my side project made one person happy, and someone else pissed off
published: true
description: 
tags: showdev, discuss
cover_image: https://thepracticaldev.s3.amazonaws.com/i/pt5rtnaljvg2kvyt3i3g.png
---


I've been working on a side project, [mydevportfol.io](https://mydevportfol.io?r=devto) for about 2 years now (on and off). It's finally at a point where it's good enough that people are willing to pay for it, which is an incredible feeling. 

I woke this morning a a Stripe notification that I'd gotten a sale overnight. Amazing! Definitely a great start to the day. 

But then I opened my emails and saw I had a message from a disgruntled user, that I had wasted their time because they thought it was free...

These were two different people of course, and maybe it's just a natural thing to happen as more people find your app, and I think maybe as devs we're just used to cool stuff on the internet being free. 

But as devs I also think we need to make sure that our work is valued, and we should know that software isn't free. Sure, sometimes we'll build cool stuff and put it out there just for the fun of it - eg a [chrome extension for managing other chrome extensions](https://chrome.google.com/webstore/detail/custom-chrome-extension-m/balnpimdnhfiodmodckhkgneejophhhm?hl=en) I built with a friend a while back, but that doesn't mean EVERYTHING we build has to be free. 

Just wanted to share - I'm a big proponent of letting people pay you for your work via donation buttons or putting a price tag on your side project - but happy to hear other thoughts.
Limits of a Headless CMS?
Tags: webdev, javascript, headless, cms
Published: 2019-02-18 14:29:59

---
title: Limits of a Headless CMS?
published: true
description: I want to find out more about the limits of using a Headless CMS.
tags: webdevelopment,javascript,headless,cms
---

Hey Dev.to!

Long story short, I am a front-end developer working on a full-stack team management application. The app is built in Node.js and MySQL, and allows team leaders to invite their team members, where they will take an assessment where they can then be graded and organised accordingly within a company.

Its being BETA launched in a few months, which I have got it stable for, but moving forward I fear for the expandability of the application in its current state.

I am tempted to start from scratch, or at least rebuild certain aspects of the app over again.

The idea is to have team management functionality but to bring in data from third-party HR applications through their APIs and then sort the user data within the application. I would like to at some point integrate some sort of in-app training functionality (videos/materials etc) as well as build a (light) testing section where users can solve problems and get a higher rating on their account.


My initial instinct was to go straight in with a Node.js/React stack, however, my skill sets lie primarily with the front-end and I fear my lack of back-end knowledge will let me down with the growing complexity of the application.


A Headless CMS like Sanity or Strapi seems like a perfect solution for those users who actually visit the application and sign up, but I am not sure just how well these are suited to allowing more complex functionality. I guess if everything was coming through a GraphQL layer then the headless CMS could be performing in parallel to data pulled from separate third party APIs. Or are they just suited to the standard website/blog/e-commerce use case I see in all the examples? Would this be a good solution for my application, or am I just opening up new problems?

Extra question:
How would you structure an application like this?

TLDR:
Is a headless CMS a good option for a complex application? If not why?
Top 5 Reasons Why You Should Choose Asp.Net MVC for Your Next Project
Tags: aspnetmvc
Published: 2019-02-18 13:32:48

---
title: Top 5 Reasons Why You Should Choose Asp.Net MVC for Your Next Project
published: True
description: Top five key benefits of MVC Using for Effective Web Application Development. check out Why to choose asp net MVC and advantages of Asp.Net MVC.
tags: Asp.Net MVC
---

A vast majority of the software developers have often experienced complexities pertaining to their preferred development frameworks.

Check Out Why ASP.Net MVC Platform is Preferred Over Web Forms:

**Separation of Concerns (SoC)** 

MVC yields a granular form of coding that’s very organized and clean. Web applications find it much easier to measure their functionality when things get simplified from the technical standpoint.

**Simplified Integration with Rich Apps on the Client Side**

With the advent of technology, web apps are getting richer at par with your desktop apps. 

**Friendly towards Search Engines**

Search engines find it easier to craw the URLs. Being stateless, MVC enables you to use a single window for spawning several web browsers at once.

**Proves Worthy of Developers that Demand More Control**

You must have experienced problems while managing raw HTML whenever a page gets developed. Such kinds of raw HTML get generated automatically by the controls present in web forms that you come across in the Official Microsoft ASP.Net website.

**Test Driven Development (TDD)**

MVC facilitates frequent testing of things that fall on the website. The applications gain an extra defensive shield against unforeseen moves when they undergo this additional layer of testing.

**Conclusion**

Once an application gets segregated into view, model, and controller, it helps in managing the complexities. The ASP.Net MVC platform doesn’t involve view state or forms based on the server making it appropriate for developers to gain further control over the behavioral pattern of an application.

Contact Us For [ASP.NET MVC Development](https://www.mindtechconsultancy.com/asp-net-mvc-development)

[Read Full Article] (https://www.mindtechconsultancy.com/why-asp-net-mvc/)
What is Magento 2?Why Magento 2
Tags: whatis, magento2, why
Published: 2019-02-18 12:15:12

---
title: What is Magento 2?Why Magento 2
published: true
description: Stop wondering what is Magento2 and why you need Magento2 for your e-commerce store. Add it your online store and see for the benefit yourself as well give your customers an unforgettable experience.
tags: what is,magento2,why
---
Magento is one of the best e-commerce platforms that help support any medium or large scale business to enrich their online store at a competitive price. In recent years the growth of the Magento platform has been tremendous and it is now being utilized by more than 200000 online retailers. With the high-performance features, rich scalability options and the large support community, it is easy to say that Magento is the best option that one can opt for when looking for the growth of their business.

[What is Magento 2](https://www.mageants.com/blog/what-is-magento-2.html)
Magento is an open source platform. Magento 1 was the first of its version for online stores, which served well for around 8 years. But with the growing online user base, the need for business growth with better performance became a necessity which was not so easily met by the use of Magento 1. And so in 2015, Magento 2 was released as its successor to meet the rising demands of the businesses. Thus Magento 2 is the latest version of the e-commerce software from the Magento family which aims in improving the speed and performance provided by various other high-level features and thus improving conversion rates for the online stores.

[Why Magento 2](https://www.mageants.com/blog/what-is-magento-2.html)
Magento 2 is the best possible shopping cart solution for your businesses. It offers a wide range of flexible tools that make it a better platform for your online stores. With the use of Magento 2, you can manage your store’s looks, content and functionalities with very much ease.

Following are a few of the detailed points which would help you in determining why Magento 2 is better and convenient as an option for e-commerce platform:

1. ADVANCED SCALABILITY AND PERFORMANCE

As compared to Magento 1, it is proven that Magento 2 works 20% faster on an average. The use of Ajax makes it convenient for users to add items to the cart without the page being reloaded. Also, the feature of full-page caching built into the platform has proven to load pages a lot faster thus making it scalable for even large scale business.

Read Continue [What is Magento 2?and Why Magento 2](https://www.mageants.com/blog/what-is-magento-2.html)
React project on GoDaddy server
Tags: react
Published: 2019-02-18 12:14:19

---
title: React project on GoDaddy server
published: true
description: 
tags: React
---

Just built my very first react app and uploaded it to my GoDaddy server.

These are the uploaded files:

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

But now, if I try to open my react project in browser, it doesn't work at all and I only see a blank page with the following errors in console:

[![enter image description here][2]][2]

I double checked, and those css files are existing inside the static folder. Why do they produce 404 error?
Am I missing something? Does a React app need special settings on external server?


  [1]: https://i.stack.imgur.com/lrmUL.png
  [2]: https://i.stack.imgur.com/Ig2me.png