-
Notifications
You must be signed in to change notification settings - Fork 265
Closed
Labels
Description
I've got a child component, let's call it Link
.
This is the code for that:
import React from 'react';
import Link from 'next/link';
export default class CustomLink extends React.Component {
render() {
if (this.props.onClick) {
return (
<span className={this.props.className} onClick={this.props.onClick}>
{this.props.children}
</span>
);
}
return (
<Link
href={this.props.href}
params={this.props.params}
as={this.props.as}>
<a className={this.props.className}>{this.props.children}</a>
</Link>
);
}
}
Now say that I import that component within another component, called Header
The code for that is:
import Link from './Link';
export default class Header extends React.Component {
render() {
return (
<div className="root">
<style jsx>{`
.link {
background-color: #fff;
border-bottom: 1px solid #eee;
color: #222;
}
`}
</style>
<Link className="link">Click me</Link>
);
}
}
However, unless I use <style jsx global>
, then unfortunately the style doesn't get passed to the child component.
I think a related issue is #197, but I haven't seen any outcome or update on that issue since June.
Is there a solution to fixing this issue?
pungggi, IharKrasnik, jul-sh, haikyuu, tim-phillips and 12 more