मैं यह इतना की तरह किया है। मेरे पास एक index.js है जो मेरे पैकेज.जेसन द्वारा शुरू की जाने वाली मुख्य फ़ाइल के रूप में संदर्भित है (एनपीएम शुरू के साथ)।
import './stylesheets/fonts.css';
import './stylesheets/main.css';
injectTapEventPlugin();
// custom MuiTheme overriding the getMuiTheme() values
const muiTheme = getMuiTheme({
palette: {
textColor: cyan500,
},
appBar: {
color: grey300,
textColor: cyan500,
height: 50
},
});
const Index =() => (
<MuiThemeProvider muiTheme={muiTheme}>
<Root />
</MuiThemeProvider>
)
render(
<Index />,
document.getElementById('app')
);
यह एक और फ़ाइल रूट पर निर्भर करता है, मेरे कंटेनर में पाया/Root.jsx फ़ाइल:
const store = configureStore();
// Create an enhanced history that syncs navigation events with the store
const history = syncHistoryWithStore(browserHistory, store);
let onUpdate =() => {window.scrollTo(0, 0); };
export default class Root extends Component {
render() {
return (
<Provider store={store}>
<div>
<Router history={history} onUpdate={onUpdate}>
<Route path="/" component={App}>
<IndexRoute component={Home}/>
<Route path="home" component={Home}/>
<Redirect path="*" to="/" />
</Route>
</Router>
<DevTools/>
</div>
</Provider>
);
}
}
आगे अनुप्रयोग है यह मैं (संक्षिप्तता के लिए कुछ आयात और इस तरह निकाला गया) है है, जो (मेरे कंटेनरों में/App.jsx फ़ाइल) अपने आवेदन की मेरी प्रारंभिक लेआउट शामिल हैं:
export default class App extends Component {
constructor(props, context) {
super(props, context);
}
static propTypes = {
children: PropTypes.node
}
render() {
return (
<Grid fluid>
<Row>
<Col>
<Header active={this.props.active} />
</Col>
</Row>
<Row>
<Col>
{this.props.children}
</Col>
</Row>
<Row>
<Col>
<Footer/>
</Col>
</Row>
</Grid>
);
}
}
const mapStateToProps = (state, ownProps) => {
return {
active: ownProps.history.isActive
};
};
export default connect(mapStateToProps)(App)
मैं उपयोग कर रहा हूँ लेआउट के लिए फ्लेक्स ग्रिड घटक प्रतिक्रिया होती है।
अब तक यह मेरे लिए काम करता है। उम्मीद है कि यह आपकी मदद करता है। InjectTapEventPlugin() कॉल को न भूलें, क्योंकि मेरे पास यह मेरी index.js फ़ाइल में है। मैं अपने ऐप के लिए .css फ़ाइलों को भी आयात करता हूं।
इस बीच मैंने इसे हल किया, वास्तव में आपके जैसा ही था। जब मैंने सवाल शुरू किया तो मैंने स्टाइलस भी इस्तेमाल किया और इससे त्रुटियां आईं। तो मैंने इसे हटा दिया। – Grego
क्या आपके पास आयात की मूल सूची है? मैं इस तरह के कुछ करने में देखना चाहता हूं, लेकिन मुझे यकीन नहीं है कि मेरे आयात को आपके साथ कैसे बढ़ाया जाए। धन्यवाद। –