learning-react-redux | Commented project in portuguese , for studying purposes | Media library
kandi X-RAY | learning-react-redux Summary
kandi X-RAY | learning-react-redux Summary
:books: Commented project in portuguese, for studying purposes
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of learning-react-redux
learning-react-redux Key Features
learning-react-redux Examples and Code Snippets
Community Discussions
Trending Discussions on learning-react-redux
QUESTION
I am trying to figure out if it's better to use redux or not, my main concern is the vertical scalability i.e. the performance.
I actually prefer to not use redux, but it seems so popular in a lot of back-end stacks, I was wondering if anyone has ever made a comparison by building a larger application to compare the speed.
The performance page on redux's site was not very helpful, as it basically only talks about performance within redux. https://redux.js.org/docs/faq/Performance.html#performance-all-reducers
I did find a lot about how it's better in practice to use Redux, like in this article below, but I don't think It quite answers my concerns https://css-tricks.com/learning-react-redux/
Please let me know what you think.
...ANSWER
Answered 2018-Feb-05 at 04:21I actually prefer to not use redux
Then you don't need redux. There is a post by the creator of Redux - "You Might Not Need Redux" that talks about your problem - https://medium.com/@dan_abramov/you-might-not-need-redux-be46360cf367
There are many factors that decide whether to use Redux or not. Personally, I like Redux because it is so much easier to manage the state of your React application. It offers great separation of concerns, keeps your code clean and minimal and on top of all, as your application grows larger and complicated, Redux makes it easier to scale and maintain.
I haven't faced any performance issues with Redux so far. It is actually the opposite. Since my code tends to be cleaner with the use of Redux, there are fewer bugs.
That said, if you do not set up things properly, you might face the consequences.
Redux isn't slow, you're just doing it wrong - An optimization guide - https://reactrocket.com/post/react-redux-optimization/
QUESTION
I am looking for a good code pattern to allow some communication between components, when using React & Redux.
Most likely this communication should be done via redux, like many articles suggest. (like this one, for example).
However, there are some situations when using the store
would be a bit of a hack rather then using it for state management. These special cases are usually when you need to give a command to a component, like show
or hide
.
I will give an example:
Lets say that we have a component which all it does is render some help icon, that when clicked, opens a tooltip popup.
And lets say that we have more than one in a page, but we want to make sure that only one is open at a given time. So if tooltip A is open, and the user clicks on tooltip B, then B should open and A should close.
Here are some patterns that I thought might be relevant to implement this requirement:
Using Redux: We could have in the store
some state for these tooltips:
ANSWER
Answered 2017-Jun-07 at 15:53The React and Redux world generally encourages representing your app's behavior as state. For example, rather than an imperative $("#someModal").show()
command, you might save a flag value somewhere that says {modalVisible : true}
.
There's numerous examples of using state to drive modals and popups. A typical implementation would store the values for a single modal or a list of modals in state somewhere (either in a parent component or in Redux), and then render modal components as appropriate based on those values, such as: {type : "notificationPopup", level : "warning", message : "Something happened!"}
. The basic approach works whether you're storing the data in React, Redux, MobX, or something else.
For specific examples, see Dan Abramov's answer to "How can I display a modal dialog in Redux?", Dave Ceddia's article "Modal Dialogs in React", the article "Scalable Modals with React and Redux". I also have other articles that demonstrate modal management in the React Component Patterns#Modal Dialogs and Redux Techniques#UI and Widget Implementations sections of my React/Redux links list.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install learning-react-redux
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page