Open mmarovich opened 6 years ago
RadioGroup
's child component should have value
, index
props.
If Option
component just renders RadioButton
, why don't you use it directly?
const pathOptions = this.props.location.data.paths.map((option, i) => {
return <RadioButton value={option} key={i} />
})
If Option component just renders RadioButton, why don't you use it directly?
Because I might want other functionality on the buttons that would dirty up the parent component. (or maybe I'm just a masochist lol).
Anyway, I changed it according to your specifications and I'm still getting the same error. Here is a link to my repo: https://github.com/mmarovich/usethatapi
Got it! you may have to pull button tag outside of the RadioGroup
component :)
So I moved the button outside of the RadioGroup, and a new error presents itself:
Uncaught TypeError: owner.getName is not a function
at Object.getCurrentStackAddendum (ReactComponentTreeHook.js:262)
at checkReactTypeSpec (checkReactTypeSpec.js:74)
at validatePropTypes (ReactElementValidator.js:160)
at Object.cloneElement (ReactElementValidator.js:247)
at RadioGroup.renderChild (index.js:105)
at index.js:128
at Array.map (<anonymous>)
at RadioGroup.render (index.js:127)
at finishClassComponent (react-dom.development.js:7873)
at updateClassComponent (react-dom.development.js:7850)
at beginWork (react-dom.development.js:8225)
at performUnitOfWork (react-dom.development.js:10224)
at workLoop (react-dom.development.js:10288)
at HTMLUnknownElement.callCallback (react-dom.development.js:542)
at Object.invokeGuardedCallbackDev (react-dom.development.js:581)
at invokeGuardedCallback (react-dom.development.js:438)
at renderRoot (react-dom.development.js:10366)
at performWorkOnRoot (react-dom.development.js:11014)
at performWork (react-dom.development.js:10967)
at batchedUpdates (react-dom.development.js:11086)
at batchedUpdates (react-dom.development.js:2330)
at dispatchEvent (react-dom.development.js:3421)
getCurrentStackAddendum @ ReactComponentTreeHook.js:262
checkReactTypeSpec @ checkReactTypeSpec.js:74
validatePropTypes @ ReactElementValidator.js:160
cloneElement @ ReactElementValidator.js:247
renderChild @ index.js:105
(anonymous) @ index.js:128
render @ index.js:127
finishClassComponent @ react-dom.development.js:7873
updateClassComponent @ react-dom.development.js:7850
beginWork @ react-dom.development.js:8225
performUnitOfWork @ react-dom.development.js:10224
workLoop @ react-dom.development.js:10288
callCallback @ react-dom.development.js:542
invokeGuardedCallbackDev @ react-dom.development.js:581
invokeGuardedCallback @ react-dom.development.js:438
renderRoot @ react-dom.development.js:10366
performWorkOnRoot @ react-dom.development.js:11014
performWork @ react-dom.development.js:10967
batchedUpdates @ react-dom.development.js:11086
batchedUpdates @ react-dom.development.js:2330
dispatchEvent @ react-dom.development.js:3421
index.js:2178 The above error occurred in the <RadioGroup> component:
in RadioGroup (at Api.js:38)
in div (at Api.js:36)
in Api (created by Route)
in Route (at Routes.js:14)
in Switch (at Routes.js:12)
in Router (created by BrowserRouter)
in BrowserRouter (at Routes.js:11)
in Routes (at App.js:13)
in div (at App.js:11)
in App (at index.js:12)
in MuiThemeProvider (at index.js:11)
Consider adding an error boundary to your tree to customize error handling behavior.
Visit https://fb.me/react-error-boundaries to learn more about error boundaries.
+1
I'm getting the following error:
I'm trying to generate the RadioButtons using a map function.
And my Option component:
I have mapped through previous data using regular inputs and labels, but I wanted to integrate this library. But I can't for the life of me figure out what is going wrong.