How can I change a property in a stateless component?
See original GitHub issueI have a stateless component:
<Button fired={fired} onClick={() => setState('fired': true)} />
how can I change fired
property when I click on the button?
Issue Analytics
- State:
- Created 7 years ago
- Reactions:3
- Comments:15 (7 by maintainers)
Top Results From Across the Web
Change Props in Stateless React.js Components ... - Pluralsight
This guide will analyze the primary role of props in a React.js component, how it is different from state , and when to...
Read more >Stateless Components From Stateful Components Cheatsheet
In React, a component should never change its own props directly. A parent component should change them. State, on the other hand, is...
Read more >How do I pass properties to stateless/functional components?
I want to pick up the lang property inside that component. Why is the variable undefined when I render it in <TestBundle />...
Read more >Learn Stateful and Stateless components in ReactJS - CronJ
It allows you to create components that are interactive and reusable. It is mutable and can only be changed by using setState() method....
Read more >Stateful and Stateless Components in React
Notice the stateless component is written as a function. As cool as state is, you should always aim to make your components as...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
May be we need to have some kind of reactive variables where we can change values. How about this:
Once you set the value, the related story will get re-rendered again. This can be even built completely outside of
@kadira/storybook
if we expose an API to reload the story.Maybe wrap your button in a stateful component? eg: