G
G
Georgy Kuznetsov2021-12-17 20:47:27
React
Georgy Kuznetsov, 2021-12-17 20:47:27

How to write an exported element (not a class) React on tsx?

Let's say we have the following jsx code:

import React from 'react';
import './SomeObjectStyle.css';

export default props => (
    <div className='SomeObjectSt'>
        <h1> Object ID: {props.id} </h1>
        <h2> Object Name : {props.name} </h2>
        <h2> Object Parameter : {props.parameter}</h2>
        <input style={{background: '#252525', color: '#6df'}} onChange={props.onUpdateBuffer} type="text"></input>
        <button style={{background: '#252525', color: '#6df'}} onClick={props.onChangeName}> Change name </button>
    </div>
)


Is it possible to write something similar on tsx?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexandroppolus, 2021-12-17
@JoeSmith3100

export default - obsolete, inconvenient crap. Forget it.
export const SomeObject = (props) => ...

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question