felixrieseberg / felixrieseberg/React-Spreadsheet-Component

Question about config settings

Open
#25 0 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
771
Forks
90
PR merge metrics
No merged PRs in 30d

Description

I'm in the process of dissecting your component and refactoring it as part of a research project. While digging through the implementation of CellComponent, I notice that there are two flags which do not appear to do what they say they do. Specifically:

```javascript
var config = {
...
// True if the data for the first column is just a string.
// Set to false if you want to pass custom DOM elements.
isHeadColumnString: true,
...
// True if the data for the cells in the first row contains strings.
// Set to false if you want to pass custom DOM elements.
isHeadRowString: true,
...
};
```
According to the documentation, the intent has something to do with passing custom DOM components. However, this is unnecessary in React as passing JSX into a display value works just fine without a flag:

```javascript
import React from 'react';
import './App.css';

function TestComponent(props) {
return

{props.config.displayValue}

}

function App() {
const simpleText = {
displayValue: 'Hello World'
}

const jsxElement = {
displayValue: Enhanced HTML for the masses
}

return (





);
}

export default App;
```

I also discovered that the only place these flags are used is as a guard condition in cell.js. The effect appears to enable clicking on a header:

```javascript
if ((config.isHeadRowString && headRow) || (config.isHeadColumnString && headColumn)) {
return (



{displayValue}



);
} else {
return (

{displayValue}

);
}

```

I suspect that these flags are some kind of legacy whose purpose mutated over the development of the component. My question is, could you confirm my suspicions or enlighten me as to the use of the flags?

If it turns out the flags are no longer necessary, I may simply remove them from my refactored prototype component.

Thank you.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.