Search This Blog

Showing posts with label react. Show all posts
Showing posts with label react. Show all posts

MUI DataGrid Column for nested object

const data = [ 
               { company: 'AAA', contact: { name: 'John Doe', email: 'john.doe@aaa.com } },
               { company: 'BBB', contact: { name: 'Mike Boh', email: 'mike.boh@bbb.com } }
             ];


const columnDefns=[
            {
                field: 'company',
                headerName: 'Company',
            },
            {
                field: 'contact',
                headerName: 'Contact',
                valueFormatter: (params) => params.contact.name
            }
            ];



see also

Styling React App with Emotion

  • Install Emotion packages into your React App by running the command inside the React project directory:
    npm install --save @emotion/react @emotion/styled
  • Add following to tsconfig.json
    {
      "compilerOptions": {
        ...
        "jsx": "react-jsx",
        "jsxImportSource": "@emotion/react",
        ...
      }
    }
  • At the top of your .tsx file, insert line:
    /** @jsxImportSource @emotion/react */



see also