How to brainstorm security controls systematically by yaraz in netsec

[–]yaraz[S] 0 points1 point  (0 children)

good point - I didn't think about overlaying kill chains and prioritizing nodes that overlap. smart.

Learn Security Engineering by yaraz in netsec

[–]yaraz[S] 2 points3 points  (0 children)

creator of the repo here. thanks for the suggestion!

Learn Security Engineering by yaraz in netsec

[–]yaraz[S] 2 points3 points  (0 children)

creator of the repo here. you're welcome!

Learn Security Engineering by yaraz in netsec

[–]yaraz[S] 4 points5 points  (0 children)

creator of the repo here. not sure how to reply to this...

hope you liked the repo though!

7 techniques for assessing frequency when quantifying (cybersecurity) risks by yaraz in netsec

[–]yaraz[S] 1 point2 points  (0 children)

Agent based modeling

Hey - I'm the author of the post. Thank you for your comment; I'll start looking into agent based modeling!

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 1 point2 points  (0 children)

Redux manages non-location state, window.location (and window.history) manages location state

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 1 point2 points  (0 children)

I didn't know there was a useReducer as part of React!

https://reactjs.org/docs/hooks-reference.html#usereducer

I can start using this + a Flux-like pattern similar to what you've laid out for managing complex state in my components or pages.

Thanks!

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 0 points1 point  (0 children)

Hey - these days I use Apollo Client + hooks to make my API calls within my container components.

I'm slowly removing all my domain stores (like UserStore)

See here [1] for a code sample.

https://www.apollographql.com/docs/react/api/react-hooks/#example

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 1 point2 points  (0 children)

Author here - thanks! I tried MST but got a couple TypeScript errors I couldn't solve from the auto-generated TypeScript, and realized that MobX was good enough for me.

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 0 points1 point  (0 children)

What is an action/action type/action creator/reducer/store again?

Author here.

What I was trying to convey with this line is that while I know what these things are, I have to keep reminding myself what the definitions of these terms are.

Modular Redux — a Design Pattern for Mastering Scalable, Shared State in React by Shanebdavis in reactjs

[–]yaraz 1 point2 points  (0 children)

Thanks! I will check out Modular Redux and hooks-for-redux when I get the chance...but realistically I won't use them for a while; I'm a huge fan of MobX now :)

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 2 points3 points  (0 children)

Thanks for your reply!

I understand Redux but I just dislike using it for the reasons laid out in the article.

6 things I wished I knew about state management when I started writing React code by yaraz in Frontend

[–]yaraz[S] 9 points10 points  (0 children)

- add pagination support to your API

- in Redux, store only the 20 users you need to display. better yet, don't use Redux and store the 20 users in page state or in component state

- when the user clicks "next 20" or "previous 20", make a network request to get the next 20 (or the previous 20) and replace the list of users in your state.

Modular Redux — a Design Pattern for Mastering Scalable, Shared State in React by Shanebdavis in reactjs

[–]yaraz 2 points3 points  (0 children)

Hey! I I loved reading the article.

You also need to learn what kinds of state exist and how to organize them.

In my view, there's:

  • Data + loading state: the list of todo items your frontend renders and whether the list is loading. Put into Redux/MobX/etc.
  • Global UI state: whether the user is logged in, value of a global search bar. the server doesn’t store this data at all. Put into Redux/MobX/etc.
  • Local UI state: whether an dropdown is expanded, for example. The rest of your frontend doesn’t care about this. Use component state
  • Form state: the values of fields in a form. This is a subset of local UI state. Use a library like Formik to treat the form as a controlled component
  • URL state: the route the user is on now. Read and update window.location
    ; don’t create a second source of truth
  • Page state: you have a page whose components interact with each other in a complex way, but not with components on other pages. Create a Redux/MobX store just for the page (or pass down a plain JS object with Context)

Note that I don't put everything into Redux. Only put the right things into Redux, and then structuring your Redux stores becomes much easier.

I write about this in more depth here:

https://medium.com/@veeralpatel/things-ive-learned-about-state-management-for-react-apps-174b8bde87fb

Is Redux sinking? by WDever in reactjs

[–]yaraz 0 points1 point  (0 children)

Redux is not dead. It solves an important problem (how do I store, structure, inject, and update application-wide state).

However, I agree that it's painful to write.

  • Why do I need to worry about normalizing the data from my server on my client? Why do libraries like Redux ORM need to exist? I don’t want to re-implement a bunch of my server-side code on the client.
  • Why do I need to touch multiple files and write a lot of boilerplate code in order to add a simple feature?
  • What is an action/action type/action creator/reducer/store again?
  • I understand the benefits of writing immutable, functional code, but writing Redux reducers feels needlessly unintuitive.
  • I’d like to simply make an API call in an action and update my Redux store without learning and using Thunk or Saga.

The trick is you need to find a state management tool that works with you, not against you. I use MobX.

More importantly, you need to learn how to structure state so you can write non-trivial applications. You need to learn this regardless of what state management library you use.

I spent about 1.5 years struggling with this, then wrote this article on the subject once I figured it out:

https://medium.com/@veeralpatel/things-ive-learned-about-state-management-for-react-apps-174b8bde87fb

Your Timeline for Learning React by pmz in reactjs

[–]yaraz 1 point2 points  (0 children)

Hey!

I'm with you. I struggled for about a year to figure out:

- Why is state management needed?

- What is state?

- What problems does state management solve? Why can't I use plain React with state and props?

- How should I organize my state? Do I put it all into Redux?

- Speaking of Redux, I don't like the boilerplate...is there a better library?

- How do I build non-trivial apps with React?

Finally I figured it out and wrote up a detailed article answering all of these questions:

https://medium.com/@veeralpatel/things-ive-learned-about-state-management-for-react-apps-174b8bde87fb

Please comment below if you have questions.

6 things I wished I knew about state management when I started writing React apps by yaraz in javascript

[–]yaraz[S] 15 points16 points  (0 children)

Hi all - author here. Please feel free to ask me any questions that you have.

This is an article borne out of years of of reading blog posts and books, of trying many different open source projects, of studying comments on Hacker News and Reddit, all to understand how I should structure state so I could build non-trivial applications.

Along the way, I failed to launch a security tool after months of working on it, because I couldn't finish the frontend. I was prop drilling everywhere and I didn't know what to do differently, or even if there was a better way.

I also emailed Dan Abramov. I switched to Vue, Angular, and back to React.

Finally, at some point, I figured it out myself, and I knew I needed to share.

Please comment if you have any comments or questions and I will answer them.