score:1
Accepted answer
sure -- just create the element dynamically and compose it.
render(){
const tag = `h${this.props.size}`
return <tag>just a moment...</tag>
}
...
<foo size={2} />
Source: stackoverflow.com
Related Query
- Automate what type of HTML element to pick React
- what is difference between the following methods about React element type
- How can I disable keyboard input on an html input of type number? What about in react or material-ui?
- What does the error "JSX element type '...' does not have any construct or call signatures" mean?
- How to access a DOM element in React? What is the equilvalent of document.getElementById() in React
- What is the TypeScript return type of a React stateless component?
- React Native error: Element type is invalid: expected a string or a class/function but got: object
- How to render a react element using an html string?
- React 16.2 <Fragment> gives Uncaught error: Element type is invalid
- What is the correct type for React Click Event?
- What is the Flow return type of a React stateless functional component?
- what is the correct type for a React instance of a component in typescript
- Custom HTML Element Tag within React JSX
- Using JS React component in TypeScript: JSX element type 'MyComponent' is not a constructor function for JSX elements
- React - cannot be used as a JSX component. Its return type 'void' is not a valid JSX element
- React Native what is type Props?
- React Bootstrap Accordion Error: Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)
- How can I convert React Element to Html element?
- What TypeScript type should React children be set to?
- React Native Element type is invalid expected a string but got undefined
- React Native Element Type is Invalid. Check Render Method
- React with TypeScript: What type is render()?
- What is the Typescript type to accept any kind of React Component as prop?
- What is the correct typescript type for react children?
- What causes an "React.Children.only expected to receive a single React element child." error in an apollo client rendered component
- React SSR error -- Element type is invalid: expected a string (for built-in components) or a class/function (for composite components) but got: object
- Inserting HTML fragments without an element container in React
- What is the simplest way of testing that a React Component contains a html node with enzyme?
- React Memo Feature gives :- Uncaught Error: Element type is invalid: expected a string but got: object
- React Bootstrap: Element type is invalid
More Query from same tag
- ReactJS: Saving a value in localStorage with useReducer
- React Native disable swiping StackNavigator in TabNavigator
- React: Display unordered lists in bootstrap carousel items from array
- Why is the CONTENT_DISPOSITION header considered unsafe?
- Calling function from button onclick not working react js
- Heroku express + react + webpack - can't run on server
- ReactJS Ant design select component mock change event
- I want to display the selected value in return below but i am unable get the data from it it might be a minor issue i am unable to catch
- Display native Map data in React
- Audio object not restarting stream when being remounted with React
- handleClick on row and checkbox in datatable
- How to pass props with HOC invocation
- A React component's function is not recognized as a function when passed in as a parameter
- Getting all 42 days that appear on a calendar month in a single array using moment.js
- Passing filtered value to react render()
- Can I autofocus on the first field in a redux-form created using a loop?
- JSON api data not loading in React
- send post request for Api in next.js
- React Hook UseEffect in combination with Firebase creating infinite loop
- Adding/Removing from array doesnt trigger rerender via redux
- Material-UI Grid does not hide when using display
- fs.opensync is not a function
- Initialize react state using function
- React: receiving Uncaught Error: Objects are not valid as a React child, when trying to render an array
- How to edit and loop an Array Object in ReactJS
- How to reset to initial coordinates after some drag operation with the library react-cytoscape.js
- I keep seeing 'XRWebGLLayer' is not defined no-undef' when using three.js in react.js to create WebXR app
- Create Antd Tree based on checked Node of another Antd Tree
- Convert string coming from variable into another variable
- Accessing an array that has an object as a value