Ability to create controlled Input components.
Nobody has claimed this yet.
Assessment
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Newbie friendliness
- 45/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Stale
- Tech stack
- javascript, react
- Domain
- frontend
Research direction
Start by locating the Input component and reading how its current value and defaultValue behavior is implemented. Check the component's existing Storybook examples and Jest tests, if present, then verify that the requested controlled and uncontrolled behaviors are covered and documented.
Written by the indexing model from the issue text.
Description
Is your feature request related to a problem? Please describe.
The current version of the Input component doesn't allow you to pass in values to the value attribute, only to the defaultValue attribute. This prevents developers from creating Input components that are controlled by passing in state to the value attribute.
Describe the solution you'd like
I would like the option to pass in a prop that gets passed into the value attribute on the input tag. One way I was thinking this could be done is by adding a prop called isControlled that determines whether the value passed into the value prop is passed down to the value or the defaultValue attribute.
If isControlled=true, pass the component's value prop to the value attribute on the input tag.
If isControlled=false, pass the component's value prop to the defaultValue attribute on the input tag. (This is how it currently works).
Describe alternatives you've considered
Another alternative would be to add another prop that is passed directly to value. However, this would allow developers to pass values to both value and defaultValue at the same time, which is considered a bad practice in React, and will generate warnings in the console.
- Dominant language
- JavaScript
- Stars
- 4
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Getting set up
We have not checked this project's setup files yet. Start from its README, and see our first-contribution guide for the general steps.
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bcgov/react-shared-components
-
It's Been a While Since This Repository has Been UpdatedMay be free again @ShellyXueHan claimed this 1670 days ago, and no pull request is open. Open
bcgov/react-shared-components#557 · 4 comments · 5 assignees ·
-
Difficulty 3/5 1-2 days Newbie friendliness 45/100
bcgov/react-shared-components#486 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 42/100
bcgov/react-shared-components#485 ·
-
approved
Difficulty 5/5 Over a week Newbie friendliness 30/100
bcgov/react-shared-components#373 · 2 comments ·
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
bcgov/react-shared-components#356 ·
All issues in bcgov/react-shared-components
Similar issues
-
curriculum documentation quality
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
githubnext/gh-aw-workshop#3897 ·
Maintainers usually reply within 2 days
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
Difficulty 2/5 1-3 hours Newbie friendliness 91/100
Maintainers usually reply within 1 day
-
check:failed feeds:add
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
iptv-org/database#36179 · 1 comment ·
Maintainers usually reply within 1 day
-
bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 84/100
Maintainers usually reply within 1 day