score:2
Thanks to @boygirl for responding to my github issue
Turns out Victory passes a few props down of its own that need to be passed along for things to be rendered correctly. Examples of this are domain
and scale
. Here's my updated component:
function Line ({ color, ...other }) {
return (
<VictoryGroup {...other}>
<VictoryLine
style={{ data: { stroke: color } }}
/>
<VictoryScatter
style={{
data: {
stroke: color,
fill: 'white',
strokeWidth: 3
}
}}
/>
</VictoryGroup>
);
}
And it is now consumed like so:
function MyCoolChart () {
return (
<VictoryChart>
<Line
color='#349CEE'
data={data1}
/>
<Line
color='#715EBD'
data={data2}
/>
</VictoryChart>
);
}
Source: stackoverflow.com
Related Query
- Why aren't Victory Charts components composable?
- Why won't my nested React components render?
- When value is assigned to components state, why console.log prints the previous state?
- Why do components in react need to be capitalized?
- Why can I not nest Route components in react-router 4.x?
- Why to use separate CSS files for components in React.js
- I can't understand why components with 'connect()' are stateful in react
- Need some assistance with Victory Charts
- Why do React components that throw errors render twice?
- Why do my react-native components overlap
- Why ReactJS components must act like pure functions?
- React Native & Redux: Why aren't child components re-rendering on every state update?
- Why use stateless functional Components instead of class-based Components?
- Victory Charts background grid
- Victory Charts - tooltip on line chart
- Why should we avoid side-effects in components constructors?
- Why is importing specific components resulting in the whole library in the bundle?
- Why is React Router causing my components to re-mount, rather than just re-rendering?
- Why are higher-order components a lot more useful than the regular component?
- Why can components only return one node in ReactJS? (Is there a fundamental reason?)
- Meteor React - Why are React Components defined differently in React Mounter vs React Layout from Kadira?
- gatsbyjs, reactjs - why components are rendering twice and images do not appear?
- Why does ReactDOM.render need to call function or class components again after creating the virtual DOM?
- Why react rerendres components even if props didn't changed?
- Why my components don't display on my React page?
- why does javascript render removed components
- Why ReactCSSTransitionGroup generates multiple components though I expect only one?
- With Styled Components why do pseudo classes seem to still work without ampersands?
- Why navbar components doesn't update after user logs in? (no Redux)
- When making react components es6 syntax why is super initialised with props?
More Query from same tag
- TypeError: Failed to construct 'URL': Please use the 'new' operator, this DOM object constructor cannot be called as a function
- How to iterate through array inside objects which is inside main object
- HTML Forms Sharing Unwanted Input Values
- How to make material ui sidebar to open the main content in react?
- Redux thunk - Nesting dispatched functions / actions
- Force a disabled MI TextField to be clickable
- I'm trying to render ONE component at a time to the DOM with an array of objects in react
- eval an input string on button press in react
- Best way to create as many unique useState as cleanly as possible?
- Submit multiple dropdown menu at once
- 'Redux' is not defined ... as well as ReactRedux and ReactDOM
- How do I store 5 variable input values in one variable in js?
- How to create a Micro Frontend bundle with Webpack that shares libraries with the container application?
- Using .filter() for React's useState setter within a .forEach() loop
- Setting parent state (object) from child causes constant re-rendering
- How to deal with xml file in next js?
- why page reload when i use history.push() in react
- Redirect to another page based on form input in Next.js
- Filter key-value pairs from JSON data
- React Antd Title - Bold
- Display comma separated elements of array in React
- Click outside drop-down and close drop-down react
- How to setup VS code debugging in Windows when running WSL?
- nested object missing after reducer state change
- How to change style property on one React component without changing them all
- ReactiveSearch, DataSearch and indexing user query
- Inspect a component's children recursively in render method
- Difference between passing event handler prop as arrow function or function reference
- How do I display an object from an array based on timer?
- Map sibling thead & tbody elements in React